Spaces:
Build error
Build error
Commit
·
ecb392e
1
Parent(s):
15aefee
fdfdff
Browse files- app_gradio_spaces.py +21 -10
app_gradio_spaces.py
CHANGED
@@ -132,7 +132,7 @@ def create_chat_ui(setup_status="Not started", services_status="Not started"):
|
|
132 |
# Output area
|
133 |
with gr.Row():
|
134 |
with gr.Column():
|
135 |
-
chatbot = gr.Chatbot(label="Conversation", height=400)
|
136 |
audio_output = gr.Audio(label="Generated Speech", interactive=False)
|
137 |
|
138 |
# Function to handle setup button
|
@@ -179,15 +179,26 @@ def create_chat_ui(setup_status="Not started", services_status="Not started"):
|
|
179 |
|
180 |
# Auto-setup on HF Spaces
|
181 |
if HF_SPACES:
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
return demo
|
193 |
|
|
|
132 |
# Output area
|
133 |
with gr.Row():
|
134 |
with gr.Column():
|
135 |
+
chatbot = gr.Chatbot(label="Conversation", height=400, type="messages")
|
136 |
audio_output = gr.Audio(label="Generated Speech", interactive=False)
|
137 |
|
138 |
# Function to handle setup button
|
|
|
179 |
|
180 |
# Auto-setup on HF Spaces
|
181 |
if HF_SPACES:
|
182 |
+
def perform_auto_setup_on_load():
|
183 |
+
# Update UI to show setup is starting
|
184 |
+
yield {
|
185 |
+
setup_output: gr.Textbox.update(value="Auto-starting setup process...")
|
186 |
+
}
|
187 |
+
|
188 |
+
# Actual setup call
|
189 |
+
final_setup_status_message = setup_environment()
|
190 |
+
|
191 |
+
# Update UI with final status and enable next button
|
192 |
+
yield {
|
193 |
+
setup_output: gr.Textbox.update(value=final_setup_status_message),
|
194 |
+
services_btn: gr.Button.update(interactive=True)
|
195 |
+
}
|
196 |
+
|
197 |
+
demo.load(
|
198 |
+
perform_auto_setup_on_load,
|
199 |
+
None,
|
200 |
+
[setup_output, services_btn]
|
201 |
+
)
|
202 |
|
203 |
return demo
|
204 |
|