hivecorp commited on
Commit
dab8207
·
verified ·
1 Parent(s): c95cd5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -87,14 +87,14 @@ def validate_srt_against_audio(srt_file_path, audio_file_path):
87
  with open(srt_file_path, 'w') as file:
88
  file.write(srt.compose(subtitles))
89
 
90
- # Gradio function with error handling
91
  async def process_script(script_text, language, voice):
92
  try:
93
  srt_path, audio_path = await batch_process_srt_and_audio(script_text, voice)
94
- return srt_path, audio_path, audio_path
95
  except Exception as e:
96
  print(f"Error: {e}")
97
- return "An error occurred. Please check the script text and try again.", None, None
98
 
99
  # Dynamic voice selection based on language
100
  def update_voice_options(language):
@@ -118,7 +118,8 @@ with gr.Blocks() as app:
118
  outputs = [
119
  gr.File(label="Download SRT File"),
120
  gr.File(label="Download Audio File"),
121
- gr.Audio(label="Play Audio")
 
122
  ]
123
 
124
  submit_button = gr.Button("Generate Audio and SRT")
 
87
  with open(srt_file_path, 'w') as file:
88
  file.write(srt.compose(subtitles))
89
 
90
+ # Gradio function with error handling and markdown message
91
  async def process_script(script_text, language, voice):
92
  try:
93
  srt_path, audio_path = await batch_process_srt_and_audio(script_text, voice)
94
+ return srt_path, audio_path, audio_path, ""
95
  except Exception as e:
96
  print(f"Error: {e}")
97
+ return None, None, None, "An error occurred. Please check the script text and try again."
98
 
99
  # Dynamic voice selection based on language
100
  def update_voice_options(language):
 
118
  outputs = [
119
  gr.File(label="Download SRT File"),
120
  gr.File(label="Download Audio File"),
121
+ gr.Audio(label="Play Audio"),
122
+ gr.Markdown(label="Error Message") # This will display any error messages
123
  ]
124
 
125
  submit_button = gr.Button("Generate Audio and SRT")