wuhp commited on
Commit
c5c444a
·
verified ·
1 Parent(s): 50f731d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -237,12 +237,12 @@ with gr.Blocks(title="HF Space Auto‑Builder", css=custom_css) as demo:
237
  # Main area
238
  with gr.Column(scale=3):
239
  gr.Markdown("## 🐢 Wuhp Auto‑Builder\nSign in, enter your prompt, and watch your Space live.")
240
- chatbot = gr.Chatbot(elem_id="chatbot")
241
  user_in = gr.Textbox(
242
  placeholder="Type your prompt and hit Enter…",
243
  label="Prompt", lines=1
244
  )
245
- send_btn = gr.Button("Send", variant="primary", show_progress=True)
246
 
247
  with gr.Tabs():
248
  with gr.TabItem("Chat"):
@@ -265,16 +265,18 @@ with gr.Blocks(title="HF Space Auto‑Builder", css=custom_css) as demo:
265
  login_btn.click(show_profile, inputs=None, outputs=status_md)
266
  login_btn.click(list_private_models, inputs=None, outputs=models_md)
267
 
268
- send_btn.click(
269
- fn=handle_user_message,
270
- inputs=[chatbot, sdk_choice, api_key, grounding, temp, max_tokens, status_md, models_md],
271
- outputs=[chatbot, build_box, run_box, preview]
272
- )
273
- user_in.submit(
274
- fn=handle_user_message,
275
- inputs=[chatbot, sdk_choice, api_key, grounding, temp, max_tokens, status_md, models_md],
276
- outputs=[chatbot, build_box, run_box, preview]
277
- )
 
 
278
 
279
  def _clear_chat():
280
  return [], "", "", "<p>No Space yet.</p>"
 
237
  # Main area
238
  with gr.Column(scale=3):
239
  gr.Markdown("## 🐢 Wuhp Auto‑Builder\nSign in, enter your prompt, and watch your Space live.")
240
+ chatbot = gr.Chatbot(elem_id="chatbot", type="messages")
241
  user_in = gr.Textbox(
242
  placeholder="Type your prompt and hit Enter…",
243
  label="Prompt", lines=1
244
  )
245
+ send_btn = gr.Button("Send", variant="primary")
246
 
247
  with gr.Tabs():
248
  with gr.TabItem("Chat"):
 
265
  login_btn.click(show_profile, inputs=None, outputs=status_md)
266
  login_btn.click(list_private_models, inputs=None, outputs=models_md)
267
 
268
+ # Wrap both click and submit in a spinner
269
+ with gr.Spinner():
270
+ send_btn.click(
271
+ fn=handle_user_message,
272
+ inputs=[chatbot, sdk_choice, api_key, grounding, temp, max_tokens, status_md, models_md],
273
+ outputs=[chatbot, build_box, run_box, preview]
274
+ )
275
+ user_in.submit(
276
+ fn=handle_user_message,
277
+ inputs=[chatbot, sdk_choice, api_key, grounding, temp, max_tokens, status_md, models_md],
278
+ outputs=[chatbot, build_box, run_box, preview]
279
+ )
280
 
281
  def _clear_chat():
282
  return [], "", "", "<p>No Space yet.</p>"