You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to python but wanted to share this incase anyone else has this issue.
Python Script
import whisper
from stable_ts.stable_whisper import modify_model
from stable_ts.stable_whisper import results_to_word_srt
model = whisper.load_model("medium")
modify_model(model)
results = model.transcribe("test.mp3")
stab_segments = results['segments']
first_segment_word_timestamps = stab_segments[0]['whole_word_timestamps']
results_to_word_srt(results, 'audio.srt', combine_compound=True)
Error:
Traceback (most recent call last):
File "C:\scripts\whispertest.py", line 12, in <module>
srt = results_to_word_srt(results, 'audio.srt')
File "C:\scripts\stable_ts\stable_whisper.py", line 223, in results_to_word_srt
to_srt(group_word_timestamps(res, combine_compound=combine_compound), srt_path)
File "C:\scripts\stable_ts\stable_whisper.py", line 109, in to_srt
f.write(srt_str)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u30b5' in position 10570: character maps to <undefined>
Fix stable_whisper.py lines 107-110:
if save_path:
with open(save_path, 'w', encoding="utf-8") as f:
f.write(srt_str)
print(f'Saved: {os.path.abspath(save_path)}')
The text was updated successfully, but these errors were encountered:
I'm new to python but wanted to share this incase anyone else has this issue.
Python Script
Error:
Fix stable_whisper.py lines 107-110:
The text was updated successfully, but these errors were encountered: