Spaces:
Runtime error
Runtime error
Commit
·
6f11b02
1
Parent(s):
79ce0ab
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,6 +84,8 @@ def process_video(radio, video, target_language):
|
|
| 84 |
subprocess.run([item for item in shell_command], capture_output=False, text=True, check=True)
|
| 85 |
|
| 86 |
segments, info = model.transcribe(f"{run_uuid}_output_audio_final.wav", beam_size=5)
|
|
|
|
|
|
|
| 87 |
whisper_text = " ".join(segment.text for segment in segments)
|
| 88 |
whisper_language = info.language
|
| 89 |
print(whisper_text)
|
|
@@ -101,7 +103,9 @@ def process_video(radio, video, target_language):
|
|
| 101 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v1")
|
| 102 |
tts.to('cuda')
|
| 103 |
tts.tts_to_file(translated_text, speaker_wav=f"{run_uuid}_output_audio_final.wav", file_path=f"{run_uuid}_output_synth.wav", language=target_language_code)
|
| 104 |
-
|
|
|
|
|
|
|
| 105 |
pad_top = 0
|
| 106 |
pad_bottom = 15
|
| 107 |
pad_left = 0
|
|
|
|
| 84 |
subprocess.run([item for item in shell_command], capture_output=False, text=True, check=True)
|
| 85 |
|
| 86 |
segments, info = model.transcribe(f"{run_uuid}_output_audio_final.wav", beam_size=5)
|
| 87 |
+
del model
|
| 88 |
+
torch.cuda.empty_cache()
|
| 89 |
whisper_text = " ".join(segment.text for segment in segments)
|
| 90 |
whisper_language = info.language
|
| 91 |
print(whisper_text)
|
|
|
|
| 103 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v1")
|
| 104 |
tts.to('cuda')
|
| 105 |
tts.tts_to_file(translated_text, speaker_wav=f"{run_uuid}_output_audio_final.wav", file_path=f"{run_uuid}_output_synth.wav", language=target_language_code)
|
| 106 |
+
del tts
|
| 107 |
+
torch.cuda.empty_cache()
|
| 108 |
+
|
| 109 |
pad_top = 0
|
| 110 |
pad_bottom = 15
|
| 111 |
pad_left = 0
|