Rausda6 commited on
Commit
b25f18d
·
verified ·
1 Parent(s): 2d415dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -349,29 +349,28 @@ async def process_input(input_text: str, input_file, language: str, speaker1: st
349
  # Gradio UI
350
  def generate_podcast_gradio(input_text, input_file, language, speaker1, speaker2, api_key, progress=gr.Progress()):
351
  # Handle the file if uploaded
352
- file_obj = None
353
- if input_file is not None:
354
- file_obj = input_file
355
-
356
- # Use the progress function from Gradio
357
  def progress_callback(value, text):
358
  progress(value, text)
359
 
360
- # Run the async function in the event loop
361
- result = asyncio.run(process_input(
362
- input_text,
363
- file_obj,
364
- language,
365
- speaker1,
366
- speaker2,
367
- api_key,
368
- progress_callback
369
- ))
 
370
  return result # Should be a string (audio file path)
371
  except Exception as e:
372
  # Don't return error string, RAISE for Gradio error popup
373
  raise gr.Error(str(e))
374
 
 
375
  def main():
376
  with gr.Blocks(title="PodcastGen 🎙️") as demo:
377
  gr.Markdown(
 
349
  # Gradio UI
350
  def generate_podcast_gradio(input_text, input_file, language, speaker1, speaker2, api_key, progress=gr.Progress()):
351
  # Handle the file if uploaded
352
+ file_obj = input_file if input_file is not None else None
353
+
 
 
 
354
  def progress_callback(value, text):
355
  progress(value, text)
356
 
357
+ try:
358
+ # Run the async function in the event loop
359
+ result = asyncio.run(process_input(
360
+ input_text,
361
+ file_obj,
362
+ language,
363
+ speaker1,
364
+ speaker2,
365
+ api_key,
366
+ progress_callback
367
+ ))
368
  return result # Should be a string (audio file path)
369
  except Exception as e:
370
  # Don't return error string, RAISE for Gradio error popup
371
  raise gr.Error(str(e))
372
 
373
+
374
  def main():
375
  with gr.Blocks(title="PodcastGen 🎙️") as demo:
376
  gr.Markdown(