Spaces:
No application file
No application file
sam133
commited on
Commit
Β·
0532aec
1
Parent(s):
9d28962
Debug Step 4: Add input components (Dropdown, advanced Textbox, Button)
Browse files
app.py
CHANGED
|
@@ -1,25 +1,47 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
Agent2Robot - Debug Step
|
| 4 |
"""
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
-
# Step
|
| 9 |
with gr.Blocks(
|
| 10 |
title="π€π Agent2Robot - MCP Hackathon 2024",
|
| 11 |
theme=gr.themes.Soft()
|
| 12 |
) as demo:
|
| 13 |
-
gr.Markdown("# Step
|
| 14 |
|
| 15 |
-
# Add basic layout structure
|
| 16 |
with gr.Row():
|
| 17 |
with gr.Column():
|
| 18 |
-
gr.Markdown("##
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
with gr.Column():
|
| 22 |
-
gr.Markdown("##
|
| 23 |
test_output = gr.Textbox(label="Test Output", value="Output text")
|
| 24 |
|
| 25 |
demo.launch()
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
Agent2Robot - Debug Step 4: Add Input Components
|
| 4 |
"""
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
+
# Step 4: Add input components (Dropdown, Textbox with parameters, Button)
|
| 9 |
with gr.Blocks(
|
| 10 |
title="π€π Agent2Robot - MCP Hackathon 2024",
|
| 11 |
theme=gr.themes.Soft()
|
| 12 |
) as demo:
|
| 13 |
+
gr.Markdown("# Step 4: Input Components Test")
|
| 14 |
|
|
|
|
| 15 |
with gr.Row():
|
| 16 |
with gr.Column():
|
| 17 |
+
gr.Markdown("## Input Section")
|
| 18 |
+
|
| 19 |
+
# Add Dropdown - CHECK: value must be from choices
|
| 20 |
+
vehicle_type = gr.Dropdown(
|
| 21 |
+
choices=["Robot", "Drone", "Autonomous Vehicle", "Robotic Arm"],
|
| 22 |
+
label="π Vehicle Type",
|
| 23 |
+
value="Robot" # String from choices - SAFE
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Add advanced Textbox - CHECK: all parameters
|
| 27 |
+
description = gr.Textbox(
|
| 28 |
+
label="π Design Requirements",
|
| 29 |
+
lines=6,
|
| 30 |
+
placeholder="Describe your requirements...",
|
| 31 |
+
value="Design a robot for warehouse navigation", # String - SAFE
|
| 32 |
+
interactive=True,
|
| 33 |
+
show_copy_button=True
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
# Add Button - CHECK: parameters
|
| 37 |
+
generate_btn = gr.Button(
|
| 38 |
+
"π Generate Design",
|
| 39 |
+
variant="primary",
|
| 40 |
+
size="lg"
|
| 41 |
+
)
|
| 42 |
|
| 43 |
with gr.Column():
|
| 44 |
+
gr.Markdown("## Output Section")
|
| 45 |
test_output = gr.Textbox(label="Test Output", value="Output text")
|
| 46 |
|
| 47 |
demo.launch()
|