saq1b commited on
Commit
1ef6114
·
verified ·
1 Parent(s): 0bb87c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -24
app.py CHANGED
@@ -509,31 +509,27 @@ async def process_input(input_text: str, input_file, language: str, speaker1: st
509
 
510
  # Gradio UI
511
  def generate_podcast_gradio(input_text, input_file, language, speaker1, speaker2, api_key, progress=gr.Progress()):
512
- try:
513
- # Handle the file if uploaded
514
- file_obj = None
515
- if input_file is not None:
516
- file_obj = input_file
517
-
518
- # Use the progress function from Gradio
519
- def progress_callback(value, text):
520
- progress(value, text)
521
-
522
- # Run the async function in the event loop
523
- result = asyncio.run(process_input(
524
- input_text,
525
- file_obj,
526
- language,
527
- speaker1,
528
- speaker2,
529
- api_key,
530
- progress_callback
531
- ))
532
 
533
- return result, None # Return audio file and no error
534
- except Exception as e:
535
- error_message = str(e)
536
- return None, error_message # Return no audio file and error message
 
 
 
 
 
 
 
 
 
 
 
 
537
 
538
  def main():
539
  # Define language options
 
509
 
510
  # Gradio UI
511
  def generate_podcast_gradio(input_text, input_file, language, speaker1, speaker2, api_key, progress=gr.Progress()):
512
+ # Handle the file if uploaded
513
+ file_obj = None
514
+ if input_file is not None:
515
+ file_obj = input_file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
 
517
+ # Use the progress function from Gradio
518
+ def progress_callback(value, text):
519
+ progress(value, text)
520
+
521
+ # Run the async function in the event loop
522
+ result = asyncio.run(process_input(
523
+ input_text,
524
+ file_obj,
525
+ language,
526
+ speaker1,
527
+ speaker2,
528
+ api_key,
529
+ progress_callback
530
+ ))
531
+
532
+ return result
533
 
534
  def main():
535
  # Define language options