Update app.py
Browse files
app.py
CHANGED
|
@@ -307,10 +307,13 @@ def generate_voiceover(translated_json, language, output_audio_path):
|
|
| 307 |
# Concatenate translated text into a single string
|
| 308 |
full_text = " ".join(entry["translated"] for entry in translated_json)
|
| 309 |
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
|
|
|
|
|
|
|
|
|
| 314 |
def upload_and_manage(file, target_language, mode="transcription"):
|
| 315 |
if file is None:
|
| 316 |
logger.info("No file uploaded. Please upload a video/audio file.")
|
|
|
|
| 307 |
# Concatenate translated text into a single string
|
| 308 |
full_text = " ".join(entry["translated"] for entry in translated_json)
|
| 309 |
|
| 310 |
+
try:
|
| 311 |
+
tts = gTTS(text=full_text, lang=language)
|
| 312 |
+
time.sleep(10) # Add a delay of 10 seconds between requests
|
| 313 |
+
tts.save(output_audio_path)
|
| 314 |
+
except Exception as e:
|
| 315 |
+
raise ValueError(f"Error generating voiceover: {e}")
|
| 316 |
+
|
| 317 |
def upload_and_manage(file, target_language, mode="transcription"):
|
| 318 |
if file is None:
|
| 319 |
logger.info("No file uploaded. Please upload a video/audio file.")
|