Spaces:
No application file
No application file
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
| #!/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() |