Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -219,10 +219,13 @@ def convert_text_to_speech(input_text: str, source_language: str, target_languag
|
|
| 219 |
if result:
|
| 220 |
for item in result:
|
| 221 |
if isinstance(item, str):
|
| 222 |
-
if item
|
| 223 |
-
|
|
|
|
|
|
|
| 224 |
else:
|
| 225 |
-
|
|
|
|
| 226 |
|
| 227 |
return audio_file_path, translated_text.strip()
|
| 228 |
|
|
|
|
| 219 |
if result:
|
| 220 |
for item in result:
|
| 221 |
if isinstance(item, str):
|
| 222 |
+
# Check if the item is a URL pointing to an audio file
|
| 223 |
+
if item.endswith('.mp3'):
|
| 224 |
+
if not audio_file_path: # Store only the first audio file path
|
| 225 |
+
audio_file_path = item
|
| 226 |
else:
|
| 227 |
+
# Concatenate the translated text
|
| 228 |
+
translated_text += item + " "
|
| 229 |
|
| 230 |
return audio_file_path, translated_text.strip()
|
| 231 |
|