Spaces:
Running
on
Zero
Running
on
Zero
artificialguybr
commited on
Commit
•
04fc8d0
1
Parent(s):
ce39024
Update app.py
Browse files
app.py
CHANGED
@@ -85,14 +85,18 @@ def process_video(radio, video, target_language, has_closeup_face):
|
|
85 |
|
86 |
shell_command = f"ffmpeg -y -i {run_uuid}_output_audio.wav -af lowpass=3000,highpass=100 {run_uuid}_output_audio_final.wav".split(" ")
|
87 |
subprocess.run([item for item in shell_command], capture_output=False, text=True, check=True)
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
90 |
try:
|
91 |
segments, info = model.transcribe(f"{run_uuid}_output_audio_final.wav", beam_size=5)
|
92 |
whisper_text = " ".join(segment.text for segment in segments)
|
93 |
whisper_language = info.language
|
94 |
-
print(whisper_text)
|
95 |
except RuntimeError as e:
|
|
|
96 |
if "CUDA failed with error device-side assert triggered" in str(e):
|
97 |
gr.Warning("Error. Space need to restart. Please retry in a minute")
|
98 |
# Restart the script
|
|
|
85 |
|
86 |
shell_command = f"ffmpeg -y -i {run_uuid}_output_audio.wav -af lowpass=3000,highpass=100 {run_uuid}_output_audio_final.wav".split(" ")
|
87 |
subprocess.run([item for item in shell_command], capture_output=False, text=True, check=True)
|
88 |
+
|
89 |
+
print("FFmpeg command completed.")
|
90 |
+
|
91 |
+
# Execute Whisper transcription
|
92 |
+
print("Attempting to transcribe with Whisper...")
|
93 |
try:
|
94 |
segments, info = model.transcribe(f"{run_uuid}_output_audio_final.wav", beam_size=5)
|
95 |
whisper_text = " ".join(segment.text for segment in segments)
|
96 |
whisper_language = info.language
|
97 |
+
print(f"Transcription successful: {whisper_text}")
|
98 |
except RuntimeError as e:
|
99 |
+
print(f"RuntimeError encountered: {str(e)}")
|
100 |
if "CUDA failed with error device-side assert triggered" in str(e):
|
101 |
gr.Warning("Error. Space need to restart. Please retry in a minute")
|
102 |
# Restart the script
|