hivecorp commited on
Commit
46fc945
·
verified ·
1 Parent(s): c920160

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -462,9 +462,8 @@ async def process_text_with_progress(
462
  ):
463
  # Input validation
464
  if not text or text.strip() == "":
465
- return None, None, None, True, "Please enter some text to convert to speech.", None, None
466
 
467
- # Format pitch and rate strings
468
  pitch_str = f"{pitch:+d}Hz" if pitch != 0 else "+0Hz"
469
  rate_str = f"{rate:+d}%" if rate != 0 else "+0%"
470
 
@@ -485,21 +484,21 @@ async def process_text_with_progress(
485
  parallel=parallel_processing
486
  )
487
 
488
- # ✅ Success: return all 7 values
489
  return (
490
  srt_path,
491
  audio_path,
492
  audio_path,
493
- False,
494
- "",
495
  create_download_link(srt_path, "Download Subtitles (.srt)"),
496
  create_download_link(audio_path, "Download Audio (.mp3)")
497
  )
498
 
499
  except TTSError as e:
500
- return None, None, None, True, f"TTS Error: {str(e)}", None, None
501
  except Exception as e:
502
- return None, None, None, True, f"Unexpected error: {str(e)}", None, None
 
503
 
504
 
505
  # Voice options dictionary
@@ -632,15 +631,15 @@ with gr.Blocks(title="Advanced TTS with Configurable SRT Generation") as app:
632
  parallel_processing
633
  ],
634
  outputs=[
635
- srt_file,
636
- audio_file,
637
- audio_output,
638
- error_output,
639
- error_output,
640
- srt_download,
641
- audio_download
642
- ],
643
- api_name="generate"
644
  )
645
 
646
  if __name__ == "__main__":
 
462
  ):
463
  # Input validation
464
  if not text or text.strip() == "":
465
+ return None, None, None, "Please enter some text to convert to speech.", "", None, None
466
 
 
467
  pitch_str = f"{pitch:+d}Hz" if pitch != 0 else "+0Hz"
468
  rate_str = f"{rate:+d}%" if rate != 0 else "+0%"
469
 
 
484
  parallel=parallel_processing
485
  )
486
 
 
487
  return (
488
  srt_path,
489
  audio_path,
490
  audio_path,
491
+ "", # error_output (no error)
492
+ "", # extra message output (optional)
493
  create_download_link(srt_path, "Download Subtitles (.srt)"),
494
  create_download_link(audio_path, "Download Audio (.mp3)")
495
  )
496
 
497
  except TTSError as e:
498
+ return None, None, None, f"TTS Error: {str(e)}", "", None, None
499
  except Exception as e:
500
+ return None, None, None, f"Unexpected error: {str(e)}", "", None, None
501
+
502
 
503
 
504
  # Voice options dictionary
 
631
  parallel_processing
632
  ],
633
  outputs=[
634
+ srt_file, # gr.File
635
+ audio_file, # gr.File
636
+ audio_output, # gr.Audio
637
+ error_output, # gr.Textbox
638
+ error_output, # gr.Textbox (or gr.Label)
639
+ srt_download, # gr.HTML
640
+ audio_download # gr.HTML
641
+ ],
642
+ api_name="generate"
643
  )
644
 
645
  if __name__ == "__main__":