Spaces:
No application file
No application file
sam133
commited on
Commit
·
44090ce
1
Parent(s):
fbfc887
� PHASE 2 STEP 2: Add input components (Radio + complex Textbox + Button)
Browse files✅ Added back from original app:
- gr.Radio with choices=['Robot', 'Drone'] and info parameter
- gr.Textbox with lines=5, long placeholder, and default value
- gr.Button with variant='primary' and size='lg'
- Multi-input function with proper parameter handling
Testing: These components have more complex schemas
app.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
Agent2Robot - Phase 2 Step
|
| 4 |
-
Systematic Debugging - Adding
|
| 5 |
"""
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
-
def dummy_function(
|
| 10 |
-
"""
|
| 11 |
-
if not
|
| 12 |
-
|
| 13 |
-
return f"
|
| 14 |
|
| 15 |
def create_minimal_app():
|
| 16 |
-
"""Create minimal Gradio interface for testing - Step
|
| 17 |
|
| 18 |
# Custom CSS for better appearance (from original)
|
| 19 |
custom_css = """
|
|
@@ -29,7 +29,7 @@ def create_minimal_app():
|
|
| 29 |
"""
|
| 30 |
|
| 31 |
with gr.Blocks(
|
| 32 |
-
title="🤖🚁 Agent2Robot - Phase 2 Step
|
| 33 |
theme=gr.themes.Soft(),
|
| 34 |
css=custom_css
|
| 35 |
) as demo:
|
|
@@ -38,51 +38,73 @@ def create_minimal_app():
|
|
| 38 |
gr.HTML("""
|
| 39 |
<div class="main-header">
|
| 40 |
<h1>🤖🚁 Agent2Robot</h1>
|
| 41 |
-
<h2>Phase 2 Step
|
| 42 |
-
<p><strong>Adding back
|
| 43 |
</div>
|
| 44 |
""")
|
| 45 |
|
| 46 |
# Static Markdown (from original)
|
| 47 |
gr.Markdown("## 🔧 Phase 2: Systematic Component Testing")
|
| 48 |
-
gr.Markdown("**Step
|
| 49 |
|
| 50 |
-
#
|
| 51 |
with gr.Row():
|
| 52 |
-
with gr.Column():
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
)
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
with gr.Column():
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
)
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
- **Test Phase**: Phase 2 Step 1
|
| 73 |
-
- **Components Added**: HTML, Markdown
|
| 74 |
-
- **Status**: Testing static components
|
| 75 |
-
""")
|
| 76 |
|
| 77 |
gr.Markdown("---")
|
| 78 |
-
gr.Markdown("**Status**: If
|
| 79 |
|
| 80 |
return demo
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
| 83 |
-
print("🔧 Agent2Robot - Phase 2 Step
|
| 84 |
print("=" * 50)
|
| 85 |
-
print("🚀 Testing
|
| 86 |
|
| 87 |
try:
|
| 88 |
app = create_minimal_app()
|
|
@@ -96,4 +118,4 @@ if __name__ == "__main__":
|
|
| 96 |
)
|
| 97 |
except Exception as e:
|
| 98 |
print(f"❌ Error launching app: {e}")
|
| 99 |
-
print("
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
Agent2Robot - Phase 2 Step 2: Adding Input Components
|
| 4 |
+
Systematic Debugging - Adding gr.Radio, complex gr.Textbox, styled gr.Button
|
| 5 |
"""
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
+
def dummy_function(vehicle_type, user_description):
|
| 10 |
+
"""Test function with multiple inputs"""
|
| 11 |
+
if not user_description:
|
| 12 |
+
user_description = "No description provided"
|
| 13 |
+
return f"Vehicle: {vehicle_type}\nDescription: {user_description}\nTest successful!"
|
| 14 |
|
| 15 |
def create_minimal_app():
|
| 16 |
+
"""Create minimal Gradio interface for testing - Step 2: Input Components"""
|
| 17 |
|
| 18 |
# Custom CSS for better appearance (from original)
|
| 19 |
custom_css = """
|
|
|
|
| 29 |
"""
|
| 30 |
|
| 31 |
with gr.Blocks(
|
| 32 |
+
title="🤖🚁 Agent2Robot - Phase 2 Step 2",
|
| 33 |
theme=gr.themes.Soft(),
|
| 34 |
css=custom_css
|
| 35 |
) as demo:
|
|
|
|
| 38 |
gr.HTML("""
|
| 39 |
<div class="main-header">
|
| 40 |
<h1>🤖🚁 Agent2Robot</h1>
|
| 41 |
+
<h2>Phase 2 Step 2: Input Components Test</h2>
|
| 42 |
+
<p><strong>Adding back gr.Radio, complex gr.Textbox, styled gr.Button</strong></p>
|
| 43 |
</div>
|
| 44 |
""")
|
| 45 |
|
| 46 |
# Static Markdown (from original)
|
| 47 |
gr.Markdown("## 🔧 Phase 2: Systematic Component Testing")
|
| 48 |
+
gr.Markdown("**Step 2**: Testing input components (Radio, Textbox, Button)")
|
| 49 |
|
| 50 |
+
# Original Input Components (from backup)
|
| 51 |
with gr.Row():
|
| 52 |
+
with gr.Column(scale=1):
|
| 53 |
+
gr.Markdown("## 🎯 1. Define Your Vehicle Challenge")
|
| 54 |
+
|
| 55 |
+
vehicle_type_input = gr.Radio(
|
| 56 |
+
choices=["Robot", "Drone"],
|
| 57 |
+
label="1. Choose Vehicle Type",
|
| 58 |
+
value="Robot",
|
| 59 |
+
info="Select whether you want a ground robot or flying drone"
|
| 60 |
)
|
| 61 |
+
|
| 62 |
+
user_description_input = gr.Textbox(
|
| 63 |
+
lines=5,
|
| 64 |
+
label="2. Describe Vehicle's Task & Success Criteria",
|
| 65 |
+
placeholder="e.g., 'Design a robot that can cross the 5cm box obstacle quickly and without tipping over, then stop safely.' or 'Create a drone that flies over the wall, lands gently 1 meter beyond it, and remains stable.'",
|
| 66 |
+
value="Design a robot that can cross the 5cm high obstacle smoothly and come to a controlled stop."
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
start_button = gr.Button(
|
| 70 |
+
"🚀 Start AI Design Process",
|
| 71 |
+
variant="primary",
|
| 72 |
+
size="lg"
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
gr.Markdown("""
|
| 76 |
+
### 📋 Environment Info
|
| 77 |
+
- **Test Phase**: Phase 2 Step 2
|
| 78 |
+
- **Components Added**: gr.Radio, gr.Textbox (complex), gr.Button (styled)
|
| 79 |
+
- **Status**: Testing input components
|
| 80 |
+
""")
|
| 81 |
|
| 82 |
+
with gr.Column(scale=2):
|
| 83 |
+
gr.Markdown("## 🤖 2. Test Output")
|
| 84 |
+
|
| 85 |
+
output_textbox = gr.Textbox(
|
| 86 |
+
label="Test Output",
|
| 87 |
+
lines=10,
|
| 88 |
+
value="",
|
| 89 |
+
interactive=False
|
| 90 |
)
|
| 91 |
|
| 92 |
+
# Connect button to test function
|
| 93 |
+
start_button.click(
|
| 94 |
+
fn=dummy_function,
|
| 95 |
+
inputs=[vehicle_type_input, user_description_input],
|
| 96 |
+
outputs=output_textbox
|
| 97 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
gr.Markdown("---")
|
| 100 |
+
gr.Markdown("**Status**: If input components work without errors, we can proceed to Step 3.")
|
| 101 |
|
| 102 |
return demo
|
| 103 |
|
| 104 |
if __name__ == "__main__":
|
| 105 |
+
print("🔧 Agent2Robot - Phase 2 Step 2")
|
| 106 |
print("=" * 50)
|
| 107 |
+
print("🚀 Testing input components...")
|
| 108 |
|
| 109 |
try:
|
| 110 |
app = create_minimal_app()
|
|
|
|
| 118 |
)
|
| 119 |
except Exception as e:
|
| 120 |
print(f"❌ Error launching app: {e}")
|
| 121 |
+
print("Input components are causing issues.")
|