Spaces:
No application file
No application file
sam133
commited on
Commit
·
11fe717
1
Parent(s):
e912d74
� PHASE 5
Browse files
app.py
CHANGED
|
@@ -1,73 +1,175 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
Agent2Robot -
|
| 4 |
-
|
|
|
|
| 5 |
"""
|
| 6 |
|
| 7 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"""
|
| 11 |
-
|
| 12 |
-
|
| 13 |
"""
|
| 14 |
-
|
| 15 |
-
user_description = "No description provided"
|
| 16 |
-
|
| 17 |
-
# Initial yield (like original)
|
| 18 |
-
yield (
|
| 19 |
-
"🚀 Initializing test process...\n", # process_log_output
|
| 20 |
-
{}, # current_design_specs_output
|
| 21 |
-
0, # progress_bar_output
|
| 22 |
-
"", # final_status_output
|
| 23 |
-
None, # simulation_video_output
|
| 24 |
-
{}, # best_design_specs_output
|
| 25 |
-
None, # download_json_output
|
| 26 |
-
"", # performance_summary_output
|
| 27 |
-
"" # llm_rationale_output
|
| 28 |
-
)
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
50,
|
| 35 |
-
"⚙️ Processing...",
|
| 36 |
-
None,
|
| 37 |
-
{},
|
| 38 |
-
None,
|
| 39 |
-
"",
|
| 40 |
-
""
|
| 41 |
-
)
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
}
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
)
|
| 66 |
|
| 67 |
-
def
|
| 68 |
-
"""Create
|
| 69 |
|
| 70 |
-
# Custom CSS for better appearance
|
| 71 |
custom_css = """
|
| 72 |
.main-header {
|
| 73 |
text-align: center;
|
|
@@ -78,28 +180,30 @@ def create_minimal_app():
|
|
| 78 |
margin-bottom: 20px;
|
| 79 |
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
|
| 80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
"""
|
| 82 |
|
| 83 |
with gr.Blocks(
|
| 84 |
-
title="🤖🚁 Agent2Robot -
|
| 85 |
theme=gr.themes.Soft(),
|
| 86 |
css=custom_css
|
| 87 |
) as demo:
|
| 88 |
|
| 89 |
-
# Header Section
|
| 90 |
gr.HTML("""
|
| 91 |
<div class="main-header">
|
| 92 |
-
<h1>🤖🚁 Agent2Robot
|
| 93 |
-
<h2>
|
| 94 |
-
<p><strong
|
|
|
|
| 95 |
</div>
|
| 96 |
""")
|
| 97 |
|
| 98 |
-
#
|
| 99 |
-
gr.Markdown("## 🔧 Phase 2: Systematic Component Testing")
|
| 100 |
-
gr.Markdown("**Step 5**: Testing generator function with yield and 9 outputs")
|
| 101 |
-
|
| 102 |
-
# Input Components (working from previous steps)
|
| 103 |
with gr.Row():
|
| 104 |
with gr.Column(scale=1):
|
| 105 |
gr.Markdown("## 🎯 1. Define Your Vehicle Challenge")
|
|
@@ -125,27 +229,26 @@ def create_minimal_app():
|
|
| 125 |
)
|
| 126 |
|
| 127 |
gr.Markdown("""
|
| 128 |
-
###
|
| 129 |
-
- **
|
| 130 |
-
- **
|
| 131 |
-
- **
|
| 132 |
-
- **Status**: Testing if yield pattern causes schema error
|
| 133 |
""")
|
| 134 |
|
| 135 |
with gr.Column(scale=2):
|
| 136 |
-
gr.Markdown("## 🤖 2.
|
| 137 |
|
| 138 |
-
# OUTPUT COMPONENTS (9 outputs like original)
|
| 139 |
process_log_output = gr.Textbox(
|
| 140 |
-
label="🤖 AI Agent -
|
| 141 |
-
lines=
|
| 142 |
interactive=False,
|
|
|
|
| 143 |
value=""
|
| 144 |
)
|
| 145 |
|
| 146 |
with gr.Row():
|
| 147 |
current_design_specs_output = gr.JSON(
|
| 148 |
-
label="⚙️
|
| 149 |
value={}
|
| 150 |
)
|
| 151 |
|
|
@@ -159,11 +262,10 @@ def create_minimal_app():
|
|
| 159 |
value=0
|
| 160 |
)
|
| 161 |
|
| 162 |
-
# Results Section
|
| 163 |
with gr.Accordion("🏆 Final Results & Design Specifications", open=True):
|
| 164 |
final_status_output = gr.Markdown(
|
| 165 |
-
|
| 166 |
-
value="Waiting for process to complete..."
|
| 167 |
)
|
| 168 |
|
| 169 |
with gr.Row():
|
|
@@ -176,19 +278,18 @@ def create_minimal_app():
|
|
| 176 |
)
|
| 177 |
|
| 178 |
performance_summary_output = gr.Markdown(
|
| 179 |
-
label="📊 Performance Summary
|
| 180 |
value=""
|
| 181 |
)
|
| 182 |
|
| 183 |
with gr.Column(scale=1):
|
| 184 |
best_design_specs_output = gr.JSON(
|
| 185 |
label="🔩 Best Vehicle Design Specifications",
|
| 186 |
-
show_label=True,
|
| 187 |
value={}
|
| 188 |
)
|
| 189 |
|
| 190 |
download_json_output = gr.File(
|
| 191 |
-
label="📄 Download
|
| 192 |
file_count="single",
|
| 193 |
type="filepath",
|
| 194 |
interactive=True,
|
|
@@ -202,9 +303,9 @@ def create_minimal_app():
|
|
| 202 |
value=""
|
| 203 |
)
|
| 204 |
|
| 205 |
-
# Connect button to
|
| 206 |
start_button.click(
|
| 207 |
-
fn=
|
| 208 |
inputs=[vehicle_type_input, user_description_input],
|
| 209 |
outputs=[
|
| 210 |
process_log_output,
|
|
@@ -216,22 +317,31 @@ def create_minimal_app():
|
|
| 216 |
download_json_output,
|
| 217 |
performance_summary_output,
|
| 218 |
llm_rationale_output
|
| 219 |
-
]
|
| 220 |
-
show_progress=False # Like original
|
| 221 |
)
|
| 222 |
|
|
|
|
| 223 |
gr.Markdown("---")
|
| 224 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
return demo
|
| 227 |
|
| 228 |
if __name__ == "__main__":
|
| 229 |
-
print("
|
| 230 |
-
print("=" *
|
| 231 |
-
print("
|
|
|
|
| 232 |
|
| 233 |
try:
|
| 234 |
-
app =
|
| 235 |
app.launch(
|
| 236 |
server_name="0.0.0.0",
|
| 237 |
server_port=7860,
|
|
@@ -242,4 +352,4 @@ if __name__ == "__main__":
|
|
| 242 |
)
|
| 243 |
except Exception as e:
|
| 244 |
print(f"❌ Error launching app: {e}")
|
| 245 |
-
print("
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
Agent2Robot - FIXED VERSION
|
| 4 |
+
Problem: Generator functions with yield cause Gradio schema errors
|
| 5 |
+
Solution: Convert to regular function returning final results
|
| 6 |
"""
|
| 7 |
|
| 8 |
import gradio as gr
|
| 9 |
+
import os
|
| 10 |
+
import json
|
| 11 |
+
import tempfile
|
| 12 |
+
from datetime import datetime
|
| 13 |
|
| 14 |
+
# Simplified backend simulation (replace with your actual imports)
|
| 15 |
+
class MockHackathonVehicleDesigner:
|
| 16 |
+
"""Mock version of your designer for testing the fix"""
|
| 17 |
+
def __init__(self):
|
| 18 |
+
self.vehicle_type = "robot"
|
| 19 |
+
self.user_task_description = ""
|
| 20 |
+
self.process_log = []
|
| 21 |
+
self.all_attempts = []
|
| 22 |
+
self.best_attempt = None
|
| 23 |
+
self.best_iteration = 1
|
| 24 |
+
self.overall_success = True
|
| 25 |
+
|
| 26 |
+
def reset_design_session(self):
|
| 27 |
+
self.process_log = []
|
| 28 |
+
self.all_attempts = []
|
| 29 |
+
|
| 30 |
+
def log_process_step(self, message):
|
| 31 |
+
self.process_log.append(message)
|
| 32 |
+
|
| 33 |
+
def parse_user_task_for_criteria(self, description):
|
| 34 |
+
return ["Cross obstacle", "Remain stable", "Stop safely"]
|
| 35 |
+
|
| 36 |
+
def run_single_iteration(self, iteration):
|
| 37 |
+
# Mock iteration
|
| 38 |
+
self.all_attempts.append({
|
| 39 |
+
'vehicle_specs': {
|
| 40 |
+
'wheel_radius': 0.05,
|
| 41 |
+
'body_length': 0.2,
|
| 42 |
+
'body_width': 0.15,
|
| 43 |
+
'body_height': 0.1,
|
| 44 |
+
'wheel_distance': 0.18
|
| 45 |
+
},
|
| 46 |
+
'design_reasoning': f'Iteration {iteration}: Optimized design for obstacle crossing',
|
| 47 |
+
'evaluation_results': {
|
| 48 |
+
'final_robot_x_position': 0.85,
|
| 49 |
+
'robot_crossed_obstacle': True,
|
| 50 |
+
'robot_remains_upright': True,
|
| 51 |
+
'no_significant_collision_with_obstacle_during_pass': True,
|
| 52 |
+
'overall_success': True
|
| 53 |
+
}
|
| 54 |
+
})
|
| 55 |
+
self.best_attempt = self.all_attempts[-1]
|
| 56 |
+
return True
|
| 57 |
+
|
| 58 |
+
def create_final_visualization(self):
|
| 59 |
+
return None # Mock - return None for no image
|
| 60 |
+
|
| 61 |
+
def save_design_specs_json(self):
|
| 62 |
+
return None # Mock - return None for no file
|
| 63 |
+
|
| 64 |
+
# Create mock designer
|
| 65 |
+
designer = MockHackathonVehicleDesigner()
|
| 66 |
+
|
| 67 |
+
def ui_function_fixed(vehicle_type, user_description):
|
| 68 |
"""
|
| 69 |
+
FIXED: Regular function (no yield) that returns final results
|
| 70 |
+
This replaces the problematic generator function
|
| 71 |
"""
|
| 72 |
+
global designer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
# Reset designer for new task
|
| 75 |
+
designer.reset_design_session()
|
| 76 |
+
designer.vehicle_type = vehicle_type.lower()
|
| 77 |
+
designer.user_task_description = user_description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
# Process in one go (no real-time updates)
|
| 80 |
+
designer.log_process_step("🚀 Initializing Agent2Robot system...")
|
| 81 |
+
|
| 82 |
+
# Parse user criteria
|
| 83 |
+
designer.log_process_step("🎯 Analyzing user task and success criteria...")
|
| 84 |
+
criteria = designer.parse_user_task_for_criteria(user_description)
|
| 85 |
+
|
| 86 |
+
designer.log_process_step(f"📋 Interpreted success criteria:")
|
| 87 |
+
for criterion in criteria:
|
| 88 |
+
designer.log_process_step(f" • {criterion}")
|
| 89 |
+
|
| 90 |
+
# Start design process
|
| 91 |
+
designer.log_process_step(f"🚀 Starting {vehicle_type} design process...")
|
| 92 |
+
designer.log_process_step(f"🎯 Target: {user_description}")
|
| 93 |
+
|
| 94 |
+
# Run iterations (simplified - no real-time updates)
|
| 95 |
+
MAX_ITERATIONS = 3
|
| 96 |
+
for iteration in range(1, MAX_ITERATIONS + 1):
|
| 97 |
+
designer.log_process_step(f"\n=== Iteration {iteration}/{MAX_ITERATIONS} ===")
|
| 98 |
+
|
| 99 |
+
try:
|
| 100 |
+
success = designer.run_single_iteration(iteration)
|
| 101 |
+
if success:
|
| 102 |
+
designer.log_process_step("🎉 SUCCESS! Design meets all criteria!")
|
| 103 |
+
break
|
| 104 |
+
except Exception as e:
|
| 105 |
+
designer.log_process_step(f"❌ Error in iteration {iteration}: {str(e)}")
|
| 106 |
+
|
| 107 |
+
# Generate final results
|
| 108 |
+
designer.log_process_step("📊 Generating final results...")
|
| 109 |
+
|
| 110 |
+
# Prepare final outputs
|
| 111 |
+
if designer.overall_success:
|
| 112 |
+
final_status = "## 🎉 SUCCESS!\n\nThe LLM agent successfully designed a vehicle that meets all criteria!"
|
| 113 |
+
else:
|
| 114 |
+
final_status = "## ⚠️ PROCESS COMPLETED\n\nThe agent completed all iterations. Showing best attempt found."
|
| 115 |
|
| 116 |
+
# Get best design specs
|
| 117 |
+
best_specs = designer.best_attempt['vehicle_specs'] if designer.best_attempt else {}
|
| 118 |
+
|
| 119 |
+
# Create visualization (mock)
|
| 120 |
+
simulation_gif_path = designer.create_final_visualization()
|
| 121 |
+
|
| 122 |
+
# Format performance summary
|
| 123 |
+
if designer.best_attempt:
|
| 124 |
+
eval_results = designer.best_attempt['evaluation_results']
|
| 125 |
+
performance_summary = f"""## 📊 Performance Summary of Best Design
|
| 126 |
+
|
| 127 |
+
**Iteration Found**: {designer.best_iteration}/{len(designer.all_attempts)}
|
| 128 |
+
**Final Position**: {eval_results.get('final_robot_x_position', 0.0):.3f}m
|
| 129 |
+
**Crossed Obstacle**: {'✅ Yes' if eval_results.get('robot_crossed_obstacle', False) else '❌ No'}
|
| 130 |
+
**Remained Stable**: {'✅ Yes' if eval_results.get('robot_remains_upright', False) else '❌ No'}
|
| 131 |
+
**Clean Pass**: {'✅ Yes' if eval_results.get('no_significant_collision_with_obstacle_during_pass', False) else '❌ No'}
|
| 132 |
+
|
| 133 |
+
**Overall Success**: {'✅ ACHIEVED' if eval_results.get('overall_success', False) else '❌ NOT FULLY ACHIEVED'}
|
| 134 |
+
|
| 135 |
+
**Target Distance**: 0.8m (obstacle clearance)
|
| 136 |
+
**Achieved Distance**: {eval_results.get('final_robot_x_position', 0.0):.3f}m
|
| 137 |
+
**Success Rate**: {100 if eval_results.get('overall_success', False) else 0}%
|
| 138 |
+
"""
|
| 139 |
+
else:
|
| 140 |
+
performance_summary = "## ❌ No successful attempts recorded"
|
| 141 |
+
|
| 142 |
+
# Get LLM rationale
|
| 143 |
+
llm_rationale = designer.best_attempt['design_reasoning'] if designer.best_attempt else "No design reasoning available"
|
| 144 |
+
|
| 145 |
+
# Create downloadable specs (mock)
|
| 146 |
+
download_specs_path = designer.save_design_specs_json()
|
| 147 |
+
|
| 148 |
+
# Final log update
|
| 149 |
+
designer.log_process_step(f"\n🏁 DESIGN PROCESS COMPLETED")
|
| 150 |
+
designer.log_process_step(f"📊 Total iterations: {len(designer.all_attempts)}")
|
| 151 |
+
designer.log_process_step(f"🏆 Best iteration: {designer.best_iteration}")
|
| 152 |
+
designer.log_process_step(f"✅ Overall success: {designer.overall_success}")
|
| 153 |
+
|
| 154 |
+
final_log = "\n".join(designer.process_log)
|
| 155 |
+
|
| 156 |
+
# RETURN (not yield) all 9 outputs at once
|
| 157 |
+
return (
|
| 158 |
+
final_log, # process_log_output
|
| 159 |
+
best_specs, # current_design_specs_output
|
| 160 |
+
100, # progress_bar_output
|
| 161 |
+
final_status, # final_status_output
|
| 162 |
+
simulation_gif_path, # simulation_video_output
|
| 163 |
+
best_specs, # best_design_specs_output
|
| 164 |
+
download_specs_path, # download_json_output
|
| 165 |
+
performance_summary, # performance_summary_output
|
| 166 |
+
llm_rationale # llm_rationale_output
|
| 167 |
)
|
| 168 |
|
| 169 |
+
def create_fixed_agent2robot_interface():
|
| 170 |
+
"""Create the FIXED Agent2Robot Gradio interface"""
|
| 171 |
|
| 172 |
+
# Custom CSS for better appearance
|
| 173 |
custom_css = """
|
| 174 |
.main-header {
|
| 175 |
text-align: center;
|
|
|
|
| 180 |
margin-bottom: 20px;
|
| 181 |
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
|
| 182 |
}
|
| 183 |
+
.process-log {
|
| 184 |
+
font-family: 'Courier New', monospace;
|
| 185 |
+
font-size: 12px;
|
| 186 |
+
line-height: 1.4;
|
| 187 |
+
}
|
| 188 |
"""
|
| 189 |
|
| 190 |
with gr.Blocks(
|
| 191 |
+
title="🤖🚁 Agent2Robot - FIXED VERSION",
|
| 192 |
theme=gr.themes.Soft(),
|
| 193 |
css=custom_css
|
| 194 |
) as demo:
|
| 195 |
|
| 196 |
+
# Header Section
|
| 197 |
gr.HTML("""
|
| 198 |
<div class="main-header">
|
| 199 |
+
<h1>🤖🚁 Agent2Robot - FIXED!</h1>
|
| 200 |
+
<h2>LLM-Agent-Designed Obstacle-Passing Vehicle System</h2>
|
| 201 |
+
<p><strong>✅ PROBLEM SOLVED: Generator function converted to regular function</strong></p>
|
| 202 |
+
<p>Describe your desired vehicle and task in natural language!</p>
|
| 203 |
</div>
|
| 204 |
""")
|
| 205 |
|
| 206 |
+
# Main Input Section
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
with gr.Row():
|
| 208 |
with gr.Column(scale=1):
|
| 209 |
gr.Markdown("## 🎯 1. Define Your Vehicle Challenge")
|
|
|
|
| 229 |
)
|
| 230 |
|
| 231 |
gr.Markdown("""
|
| 232 |
+
### ✅ FIXED!
|
| 233 |
+
- **Problem**: Generator function with yield statements
|
| 234 |
+
- **Solution**: Regular function returning final results
|
| 235 |
+
- **Status**: Schema error resolved!
|
|
|
|
| 236 |
""")
|
| 237 |
|
| 238 |
with gr.Column(scale=2):
|
| 239 |
+
gr.Markdown("## 🤖 2. AI Agent Results")
|
| 240 |
|
|
|
|
| 241 |
process_log_output = gr.Textbox(
|
| 242 |
+
label="🤖 AI Agent - Process Log",
|
| 243 |
+
lines=15,
|
| 244 |
interactive=False,
|
| 245 |
+
elem_classes=["process-log"],
|
| 246 |
value=""
|
| 247 |
)
|
| 248 |
|
| 249 |
with gr.Row():
|
| 250 |
current_design_specs_output = gr.JSON(
|
| 251 |
+
label="⚙️ Design Specs",
|
| 252 |
value={}
|
| 253 |
)
|
| 254 |
|
|
|
|
| 262 |
value=0
|
| 263 |
)
|
| 264 |
|
| 265 |
+
# Results Section
|
| 266 |
with gr.Accordion("🏆 Final Results & Design Specifications", open=True):
|
| 267 |
final_status_output = gr.Markdown(
|
| 268 |
+
value="Click 'Start AI Design Process' to begin..."
|
|
|
|
| 269 |
)
|
| 270 |
|
| 271 |
with gr.Row():
|
|
|
|
| 278 |
)
|
| 279 |
|
| 280 |
performance_summary_output = gr.Markdown(
|
| 281 |
+
label="📊 Performance Summary",
|
| 282 |
value=""
|
| 283 |
)
|
| 284 |
|
| 285 |
with gr.Column(scale=1):
|
| 286 |
best_design_specs_output = gr.JSON(
|
| 287 |
label="🔩 Best Vehicle Design Specifications",
|
|
|
|
| 288 |
value={}
|
| 289 |
)
|
| 290 |
|
| 291 |
download_json_output = gr.File(
|
| 292 |
+
label="📄 Download Design Specs (JSON)",
|
| 293 |
file_count="single",
|
| 294 |
type="filepath",
|
| 295 |
interactive=True,
|
|
|
|
| 303 |
value=""
|
| 304 |
)
|
| 305 |
|
| 306 |
+
# Connect button to FIXED function (no more yield!)
|
| 307 |
start_button.click(
|
| 308 |
+
fn=ui_function_fixed,
|
| 309 |
inputs=[vehicle_type_input, user_description_input],
|
| 310 |
outputs=[
|
| 311 |
process_log_output,
|
|
|
|
| 317 |
download_json_output,
|
| 318 |
performance_summary_output,
|
| 319 |
llm_rationale_output
|
| 320 |
+
]
|
|
|
|
| 321 |
)
|
| 322 |
|
| 323 |
+
# Information Footer
|
| 324 |
gr.Markdown("---")
|
| 325 |
+
gr.Markdown("""
|
| 326 |
+
## ✅ PROBLEM SOLVED!
|
| 327 |
+
|
| 328 |
+
**Root Cause**: Generator functions with `yield` statements cause `TypeError: argument of type 'bool' is not iterable` during Gradio's API schema generation.
|
| 329 |
+
|
| 330 |
+
**Solution**: Convert generator function to regular function that returns final results instead of yielding intermediate updates.
|
| 331 |
+
|
| 332 |
+
**Trade-off**: No real-time progress updates, but fully functional interface.
|
| 333 |
+
""")
|
| 334 |
|
| 335 |
return demo
|
| 336 |
|
| 337 |
if __name__ == "__main__":
|
| 338 |
+
print("🤖🚁 Agent2Robot - FIXED VERSION")
|
| 339 |
+
print("=" * 60)
|
| 340 |
+
print("✅ Generator function converted to regular function")
|
| 341 |
+
print("🚀 Launching fixed interface...")
|
| 342 |
|
| 343 |
try:
|
| 344 |
+
app = create_fixed_agent2robot_interface()
|
| 345 |
app.launch(
|
| 346 |
server_name="0.0.0.0",
|
| 347 |
server_port=7860,
|
|
|
|
| 352 |
)
|
| 353 |
except Exception as e:
|
| 354 |
print(f"❌ Error launching app: {e}")
|
| 355 |
+
print("Please check the implementation.")
|