Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -357,7 +357,7 @@ async def demo_conversation():
|
|
357 |
# print(f"Error testing Kokoro TTS: {e}")
|
358 |
|
359 |
|
360 |
-
|
361 |
# Create the async function wrapper for Gradio
|
362 |
async def process_audio_gradio(audio_file, system_prompt_input):
|
363 |
|
@@ -391,12 +391,6 @@ async def process_audio_gradio(audio_file, system_prompt_input):
|
|
391 |
with gr.Blocks() as demo:
|
392 |
gr.Markdown("# Asynchronous AI Conversation System")
|
393 |
gr.Markdown("Upload an audio file and provide a system prompt to get a response.")
|
394 |
-
|
395 |
-
if(isLoaded==false):
|
396 |
-
ai_conversation = AsyncAIConversation()
|
397 |
-
# Initialize all models
|
398 |
-
await ai_conversation.initialize_models()
|
399 |
-
isLoaded = True
|
400 |
|
401 |
with gr.Row():
|
402 |
audio_input = gr.Audio(label="Upload Audio File", type="filepath")
|
@@ -428,6 +422,11 @@ with gr.Blocks() as demo:
|
|
428 |
# We can directly launch the demo.
|
429 |
|
430 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
431 |
# Gradio launch itself runs an event loop.
|
432 |
# Ensure ai_conversation is initialized in the notebook before this cell is run.
|
433 |
demo.launch(debug=False, share=True)
|
|
|
357 |
# print(f"Error testing Kokoro TTS: {e}")
|
358 |
|
359 |
|
360 |
+
|
361 |
# Create the async function wrapper for Gradio
|
362 |
async def process_audio_gradio(audio_file, system_prompt_input):
|
363 |
|
|
|
391 |
with gr.Blocks() as demo:
|
392 |
gr.Markdown("# Asynchronous AI Conversation System")
|
393 |
gr.Markdown("Upload an audio file and provide a system prompt to get a response.")
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
|
395 |
with gr.Row():
|
396 |
audio_input = gr.Audio(label="Upload Audio File", type="filepath")
|
|
|
422 |
# We can directly launch the demo.
|
423 |
|
424 |
if __name__ == "__main__":
|
425 |
+
|
426 |
+
ai_conversation = AsyncAIConversation()
|
427 |
+
# Initialize all models
|
428 |
+
await ai_conversation.initialize_models()
|
429 |
+
|
430 |
# Gradio launch itself runs an event loop.
|
431 |
# Ensure ai_conversation is initialized in the notebook before this cell is run.
|
432 |
demo.launch(debug=False, share=True)
|