Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse filesfixed metadata status validation
- Gradio_UI.py +4 -4
Gradio_UI.py
CHANGED
|
@@ -9,7 +9,7 @@ from smolagents.memory import MemoryStep
|
|
| 9 |
from smolagents.utils import _is_package_available
|
| 10 |
|
| 11 |
def pull_messages_from_step(step_log: MemoryStep):
|
| 12 |
-
"""Extract ChatMessage objects from agent steps with proper nesting
|
| 13 |
import gradio as gr
|
| 14 |
if isinstance(step_log, ActionStep):
|
| 15 |
step_number = f"Step {step_log.step_number}" if step_log.step_number is not None else "Processing"
|
|
@@ -74,7 +74,7 @@ def stream_to_gradio(
|
|
| 74 |
reset_agent_memory: bool = False,
|
| 75 |
additional_args: Optional[dict] = None,
|
| 76 |
):
|
| 77 |
-
"""Runs agent and streams messages as gradio ChatMessages
|
| 78 |
if not _is_package_available("gradio"):
|
| 79 |
raise ModuleNotFoundError("Install gradio: `pip install 'smolagents[gradio]'`")
|
| 80 |
import gradio as gr
|
|
@@ -135,14 +135,14 @@ class GradioUI:
|
|
| 135 |
with gr.Row():
|
| 136 |
text_input = gr.Textbox(
|
| 137 |
label="Describe your trip",
|
| 138 |
-
placeholder="e.g., '
|
| 139 |
lines=2,
|
| 140 |
)
|
| 141 |
submit_btn = gr.Button("Plan My Trip", variant="primary")
|
| 142 |
gr.Markdown("""
|
| 143 |
### 💡 Tips for best results:
|
| 144 |
• Include: destination, dates, origin city, budget amount + currency
|
| 145 |
-
• Example: *"5-day
|
| 146 |
""")
|
| 147 |
submit_btn.click(
|
| 148 |
self.interact_with_agent,
|
|
|
|
| 9 |
from smolagents.utils import _is_package_available
|
| 10 |
|
| 11 |
def pull_messages_from_step(step_log: MemoryStep):
|
| 12 |
+
"""Extract ChatMessage objects from agent steps with proper nesting"""
|
| 13 |
import gradio as gr
|
| 14 |
if isinstance(step_log, ActionStep):
|
| 15 |
step_number = f"Step {step_log.step_number}" if step_log.step_number is not None else "Processing"
|
|
|
|
| 74 |
reset_agent_memory: bool = False,
|
| 75 |
additional_args: Optional[dict] = None,
|
| 76 |
):
|
| 77 |
+
"""Runs agent and streams messages as gradio ChatMessages"""
|
| 78 |
if not _is_package_available("gradio"):
|
| 79 |
raise ModuleNotFoundError("Install gradio: `pip install 'smolagents[gradio]'`")
|
| 80 |
import gradio as gr
|
|
|
|
| 135 |
with gr.Row():
|
| 136 |
text_input = gr.Textbox(
|
| 137 |
label="Describe your trip",
|
| 138 |
+
placeholder="e.g., '4-day Barcelona trip from NYC, Oct 15-19, budget $1500 USD'",
|
| 139 |
lines=2,
|
| 140 |
)
|
| 141 |
submit_btn = gr.Button("Plan My Trip", variant="primary")
|
| 142 |
gr.Markdown("""
|
| 143 |
### 💡 Tips for best results:
|
| 144 |
• Include: destination, dates, origin city, budget amount + currency
|
| 145 |
+
• Example: *"5-day Lisbon trip from London, Sep 20-24, budget £800 GBP"*
|
| 146 |
""")
|
| 147 |
submit_btn.click(
|
| 148 |
self.interact_with_agent,
|