Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,9 +3,14 @@
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import asyncio
|
6 |
-
from ai_system.ai_core import AICore
|
7 |
import speech_recognition as sr
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Initialize the AI core
|
10 |
ai = AICore()
|
11 |
|
@@ -40,11 +45,4 @@ with gr.Blocks() as demo:
|
|
40 |
query_entry = gr.Textbox(label="Enter your query")
|
41 |
response_area = gr.Textbox(label="Response")
|
42 |
submit_button = gr.Button("Submit")
|
43 |
-
voice_button = gr
|
44 |
-
|
45 |
-
# Set up the event listeners
|
46 |
-
submit_button.click(submit_query, inputs=query_entry, outputs=response_area)
|
47 |
-
voice_button.click(listen_voice_command, outputs=query_entry)
|
48 |
-
|
49 |
-
# Launch the Gradio app
|
50 |
-
demo.launch(show_error=True)
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import asyncio
|
|
|
6 |
import speech_recognition as sr
|
7 |
|
8 |
+
# Mock AI core for demonstration purposes
|
9 |
+
class AICore:
|
10 |
+
async def generate_response(self, query, user_id):
|
11 |
+
await asyncio.sleep(1) # Simulate async processing
|
12 |
+
return {"response": f"AI Response to: {query}"}
|
13 |
+
|
14 |
# Initialize the AI core
|
15 |
ai = AICore()
|
16 |
|
|
|
45 |
query_entry = gr.Textbox(label="Enter your query")
|
46 |
response_area = gr.Textbox(label="Response")
|
47 |
submit_button = gr.Button("Submit")
|
48 |
+
voice_button = gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|