Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -75,8 +75,25 @@ def response(
|
|
75 |
|
76 |
yield AdditionalOutputs(chatbot)
|
77 |
|
78 |
-
# Create
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
stream = Stream(
|
81 |
modality="audio",
|
82 |
mode="send-receive",
|
@@ -84,8 +101,8 @@ stream = Stream(
|
|
84 |
additional_outputs_handler=lambda a, b: b,
|
85 |
additional_inputs=[chatbot],
|
86 |
additional_outputs=[chatbot],
|
87 |
-
|
88 |
-
rtc_configuration=rtc_config
|
89 |
)
|
90 |
|
91 |
# Create FastAPI app and mount stream
|
|
|
75 |
|
76 |
yield AdditionalOutputs(chatbot)
|
77 |
|
78 |
+
# Create a custom UI with Blocks for better rendering
|
79 |
+
with gr.Blocks(theme=gr.themes.Default()) as custom_ui:
|
80 |
+
gr.Markdown("# LLM Voice Chat (Powered by DeepSeek & ElevenLabs)")
|
81 |
+
gr.Markdown("Speak after clicking the microphone button below. Your conversation will appear in the chat.")
|
82 |
+
|
83 |
+
with gr.Row():
|
84 |
+
chatbot = gr.Chatbot(
|
85 |
+
value=[],
|
86 |
+
height=500,
|
87 |
+
show_label=False,
|
88 |
+
type="messages",
|
89 |
+
elem_id="chatbot"
|
90 |
+
)
|
91 |
+
|
92 |
+
# The mic_placeholder will be replaced by FastRTC with the audio controls
|
93 |
+
with gr.Row():
|
94 |
+
mic_placeholder = gr.Markdown("## Voice Controls Will Appear Here")
|
95 |
+
|
96 |
+
# Create Stream with the custom UI
|
97 |
stream = Stream(
|
98 |
modality="audio",
|
99 |
mode="send-receive",
|
|
|
101 |
additional_outputs_handler=lambda a, b: b,
|
102 |
additional_inputs=[chatbot],
|
103 |
additional_outputs=[chatbot],
|
104 |
+
ui=custom_ui, # Use our custom UI instead of ui_args
|
105 |
+
rtc_configuration=rtc_config
|
106 |
)
|
107 |
|
108 |
# Create FastAPI app and mount stream
|