Agent2Robot / launch_hackathon_demo.py
sam133's picture
Implement full Gradio UI and backend logic for agentic vehicle design - Add complete Agent2Robot interface with real-time updates, LLM-driven iterative design optimization, PyBullet physics simulation integration, comprehensive evaluation and feedback systems, hackathon demo and documentation files - Ready for deployment to Hugging Face Space
46074e2
raw
history blame
6.8 kB
#!/usr/bin/env python3
"""
Hackathon Demo Launcher
LLM-Agent-Designed Obstacle-Passing Vehicle System
Track 3: Agentic Demo Showcase
"""
import sys
import os
import ssl
# SSL workaround for Gradio/network issues
try:
import certifi
os.environ['SSL_CERT_FILE'] = certifi.where()
except ImportError:
pass
# Try to disable SSL verification as a workaround
try:
ssl._create_default_https_context = ssl._create_unverified_context
except AttributeError:
pass
import webbrowser
import time
def print_banner():
"""Print the hackathon banner"""
print("=" * 80)
print("πŸ€–πŸš LLM-AGENT-DESIGNED VEHICLE SYSTEM - HACKATHON DEMO")
print(" TRACK 3: AGENTIC DEMO SHOWCASE")
print("=" * 80)
print()
def check_dependencies():
"""Check if all required dependencies are installed"""
print("πŸ” Checking dependencies...")
missing_deps = []
# Check for required packages
required_packages = [
('gradio', 'gradio'),
('pybullet', 'pybullet'),
('transformers', 'transformers'),
('torch', 'torch'),
('Pillow', 'PIL'),
('imageio', 'imageio'),
('numpy', 'numpy')
]
for package_name, import_name in required_packages:
try:
__import__(import_name)
print(f" βœ… {package_name}")
except ImportError:
print(f" ❌ {package_name} - MISSING")
missing_deps.append(package_name)
except Exception as e:
print(f" ⚠️ {package_name} - Import warning: {str(e)[:50]}...")
if missing_deps:
print(f"\n⚠️ Missing dependencies: {', '.join(missing_deps)}")
print("Please install them using:")
print(" pip install -r requirements.txt")
return False
print("βœ… All dependencies are available!")
return True
def show_options():
"""Show available demo options"""
print("\n🎯 HACKATHON DEMO OPTIONS:")
print()
print("1. 🌐 Interactive Gradio Web Interface (Recommended)")
print(" - Full agentic demo with real-time feedback")
print(" - Visual simulation results")
print(" - Downloadable design specifications")
print()
print("2. πŸ–₯️ System Demonstration & Feature Overview")
print(" - Comprehensive feature walkthrough")
print(" - Technical implementation details")
print(" - Hackathon judging criteria alignment")
print()
print("3. πŸ“š Documentation & README Preview")
print(" - View generated README content")
print(" - Submission materials overview")
print()
def launch_gradio_demo():
"""Launch the main Gradio interface"""
print("πŸš€ Launching Interactive Gradio Demo...")
print("This will start the web interface where you can:")
print(" β€’ Select vehicle type (robot/drone)")
print(" β€’ Describe your design task in natural language")
print(" β€’ Watch the LLM agent work in real-time")
print(" β€’ See physics simulation results")
print(" β€’ Download design specifications")
print()
try:
from main_orchestrator import create_hackathon_gradio_interface
print("Creating interface...")
interface = create_hackathon_gradio_interface()
print("βœ… Interface created successfully!")
print()
print("🌐 Starting web server...")
print("πŸ“‹ The demo will open in your browser automatically")
print("πŸ”— URL: http://localhost:7860")
print()
print("πŸ’‘ TIP: Try these example tasks:")
print(" β€’ 'Design a robot that crosses quickly and stops safely'")
print(" β€’ 'Create a drone that flies over and lands gently'")
print(" β€’ 'Build a stable robot for rough terrain'")
print()
print("⚠️ Press Ctrl+C to stop the server")
print()
# Launch with browser opening
interface.launch(
server_name="0.0.0.0",
server_port=7860,
share=False, # Set to True for public sharing
show_error=True,
inbrowser=True,
quiet=False
)
except Exception as e:
print(f"❌ Error launching Gradio demo: {e}")
print("Please check your installation and try again.")
return False
return True
def run_system_demo():
"""Run the comprehensive system demonstration"""
print("πŸ–₯️ Running System Demonstration...")
print()
try:
from hackathon_demo import main
main()
except Exception as e:
print(f"❌ Error running system demo: {e}")
return False
return True
def show_readme():
"""Display README content"""
print("πŸ“š README & Documentation Preview...")
print()
try:
with open('README.md', 'r', encoding='utf-8') as f:
content = f.read()
# Show first part of README
lines = content.split('\n')
preview_lines = lines[:50] # Show first 50 lines
for line in preview_lines:
print(line)
if len(lines) > 50:
print("\n... (README continues - see README.md for full content)")
print(f"\nπŸ“„ Full README available in: README.md")
print(f"πŸ“Š Total README length: {len(lines)} lines")
except Exception as e:
print(f"❌ Error reading README: {e}")
return False
return True
def main():
"""Main launcher function"""
print_banner()
# Check dependencies first
if not check_dependencies():
print("\n❌ Cannot proceed without required dependencies.")
sys.exit(1)
# Show options
show_options()
while True:
try:
print("\n" + "─" * 60)
choice = input("Enter your choice (1-3, or 'q' to quit): ").strip().lower()
if choice in ['q', 'quit', 'exit']:
print("πŸ‘‹ Thank you for exploring our hackathon submission!")
break
elif choice == '1':
if launch_gradio_demo():
break # Exit after Gradio demo ends
elif choice == '2':
run_system_demo()
elif choice == '3':
show_readme()
else:
print("❌ Invalid choice. Please enter 1, 2, 3, or 'q'.")
except KeyboardInterrupt:
print("\n\nπŸ‘‹ Demo interrupted. Thank you for exploring our submission!")
break
except Exception as e:
print(f"\n❌ Unexpected error: {e}")
print("Please try again or contact the developers.")
if __name__ == "__main__":
main()