Tonic commited on
Commit
e6f14ff
·
1 Parent(s): 2d01742

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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.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
 
 
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