Spaces:
Build error
Build error
Translate done
Browse files- download.py +3 -3
download.py
CHANGED
@@ -191,10 +191,9 @@ def caption_generator(social_media_url,uid, language="Autodetect", model_size=mo
|
|
191 |
if detected_language != "en":
|
192 |
print(f"Transcribe successful! Starting translation to English")
|
193 |
translate_whisper_result = transcribe(audio, translate_action=True, language=detected_language, override_model_size=model_size)
|
194 |
-
print(f"Trfan!, writing files")
|
195 |
en_vtt_path = tempdir / f"en.vtt"
|
196 |
with open(en_vtt_path.resolve(), "w", encoding="utf-8") as en_vtt:
|
197 |
-
write_vtt(
|
198 |
print(f"Finished translation to English, preparing subtitle files")
|
199 |
whisper_result_captions.append(
|
200 |
{
|
@@ -206,7 +205,8 @@ def caption_generator(social_media_url,uid, language="Autodetect", model_size=mo
|
|
206 |
except Exception as e:
|
207 |
print(f"Could not transcribe file: {e}")
|
208 |
raise
|
209 |
-
|
|
|
210 |
return 'success', whisper_result_captions
|
211 |
|
212 |
# Run whisper with translation task enabled (and save to different srt file)
|
|
|
191 |
if detected_language != "en":
|
192 |
print(f"Transcribe successful! Starting translation to English")
|
193 |
translate_whisper_result = transcribe(audio, translate_action=True, language=detected_language, override_model_size=model_size)
|
|
|
194 |
en_vtt_path = tempdir / f"en.vtt"
|
195 |
with open(en_vtt_path.resolve(), "w", encoding="utf-8") as en_vtt:
|
196 |
+
write_vtt(translate_whisper_result["segments"], file=en_vtt)
|
197 |
print(f"Finished translation to English, preparing subtitle files")
|
198 |
whisper_result_captions.append(
|
199 |
{
|
|
|
205 |
except Exception as e:
|
206 |
print(f"Could not transcribe file: {e}")
|
207 |
raise
|
208 |
+
print(f"Finished processing {uid} file, returning results")
|
209 |
+
print(whisper_result_captions)
|
210 |
return 'success', whisper_result_captions
|
211 |
|
212 |
# Run whisper with translation task enabled (and save to different srt file)
|