# 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)