Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -217,15 +217,14 @@ def convert_text_to_speech(input_text: str, source_language: str, target_languag
|
|
217 |
|
218 |
# Process the result
|
219 |
if result:
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
return audio_file_path, translated_text
|
229 |
|
230 |
except Exception as e:
|
231 |
return None, f"Error in text-to-speech conversion: {str(e)}"
|
|
|
217 |
|
218 |
# Process the result
|
219 |
if result:
|
220 |
+
for item in result:
|
221 |
+
if isinstance(item, str):
|
222 |
+
if item.endswith('.mp3') and not audio_file_path:
|
223 |
+
audio_file_path = item # Store the first audio file path
|
224 |
+
else:
|
225 |
+
translated_text += item + " " # Concatenate the translated text
|
226 |
+
|
227 |
+
return audio_file_path, translated_text.strip()
|
|
|
228 |
|
229 |
except Exception as e:
|
230 |
return None, f"Error in text-to-speech conversion: {str(e)}"
|