Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -549,31 +549,24 @@ with gr.Blocks(
|
|
| 549 |
label="Your question",
|
| 550 |
interactive=True
|
| 551 |
)
|
| 552 |
-
|
| 553 |
-
# --- Function to respond ---
|
| 554 |
def respond(message, history):
|
| 555 |
try:
|
| 556 |
-
# Use agent.run() to maintain internal state
|
| 557 |
out = str(agent.run(message))
|
| 558 |
except Exception as e:
|
| 559 |
out = f"[Error] {e}"
|
| 560 |
-
|
| 561 |
-
# Append to chat history
|
| 562 |
history = (history or []) + [(message, out)]
|
| 563 |
return "", history
|
| 564 |
-
|
| 565 |
-
# --- Examples for quick testing ---
|
| 566 |
gr.Examples(
|
| 567 |
examples=[
|
| 568 |
"Who is Ed?",
|
| 569 |
-
"Who
|
| 570 |
-
"How to access the laser cutter"
|
| 571 |
],
|
| 572 |
-
inputs=[inp],
|
| 573 |
fn=respond,
|
| 574 |
-
|
|
|
|
| 575 |
)
|
| 576 |
-
|
| 577 |
# --- Connect input to chat ---
|
| 578 |
inp.submit(respond, [inp, chat], [inp, chat])
|
| 579 |
|
|
|
|
| 549 |
label="Your question",
|
| 550 |
interactive=True
|
| 551 |
)
|
|
|
|
|
|
|
| 552 |
def respond(message, history):
|
| 553 |
try:
|
|
|
|
| 554 |
out = str(agent.run(message))
|
| 555 |
except Exception as e:
|
| 556 |
out = f"[Error] {e}"
|
|
|
|
|
|
|
| 557 |
history = (history or []) + [(message, out)]
|
| 558 |
return "", history
|
| 559 |
+
|
|
|
|
| 560 |
gr.Examples(
|
| 561 |
examples=[
|
| 562 |
"Who is Ed?",
|
| 563 |
+
"Who should I talk to for building a wooden table?",
|
| 564 |
+
"How to access the laser cutter?"
|
| 565 |
],
|
|
|
|
| 566 |
fn=respond,
|
| 567 |
+
inputs=[inp],
|
| 568 |
+
outputs=[chat]
|
| 569 |
)
|
|
|
|
| 570 |
# --- Connect input to chat ---
|
| 571 |
inp.submit(respond, [inp, chat], [inp, chat])
|
| 572 |
|