Download deployer/deployer.py from mgbam/robosage: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/mgbam/robosage/resolve/a8f1886e1e534671834283972a7fd3bac8cdf10e/deployer/deployer.py
- Command line
-
hf download hf://spaces/mgbam/robosage@a8f1886e1e534671834283972a7fd3bac8cdf10e/deployer/deployer.py
-
curl -L -o deployer.py https://huggingface.co/spaces/mgbam/robosage/resolve/a8f1886e1e534671834283972a7fd3bac8cdf10e/deployer/deployer.py
1.4 kB
| # deployer.py - Orchestrates full app deployment: from code to interactive app | |
| import os | |
| import time | |
| from core_creator.voice_to_app import VoiceToAppCreator | |
| from deployer.gradio_generator import launch_gradio_app | |
| from gradio import Blocks | |
| # Optional: create a folder to store generated apps or logs | |
| GENERATED_DIR = "generated_apps" | |
| os.makedirs(GENERATED_DIR, exist_ok=True) | |
| def deploy_robot_app(user_idea: str) -> dict: | |
| print("[π] Starting deployment for user idea...") | |
| # Step 1: Generate all components | |
| creator = VoiceToAppCreator(user_idea) | |
| app_assets = creator.run_pipeline() | |
| # Step 2: Save the generated code (optional archival) | |
| code_path = os.path.join(GENERATED_DIR, f"{app_assets['intent']}_robot_app.py") | |
| with open(code_path, "w") as f: | |
| f.write(app_assets["code"]) | |
| print(f"[π¦] Code saved at: {code_path}") | |
| # Step 3: Launch app in memory | |
| app_ui: Blocks = launch_gradio_app( | |
| title=app_assets["blueprint"]["title"], | |
| description=app_assets["blueprint"]["description"] | |
| ) | |
| print("[β ] Deployment ready! Launching app...") | |
| app_ui.launch(share=True) | |
| return { | |
| "status": "success", | |
| "intent": app_assets['intent'], | |
| "code_file": code_path | |
| } | |
| # Example usage | |
| if __name__ == "__main__": | |
| idea = "Build a robot that compliments people when they smile at it." | |
| deploy_robot_app(idea) | |