Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
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 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|