|
|
|
|
|
import os |
|
import time |
|
from core_creator.voice_to_app import VoiceToAppCreator |
|
from deployer.gradio_generator import launch_gradio_app |
|
from gradio import Blocks |
|
|
|
|
|
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...") |
|
|
|
|
|
creator = VoiceToAppCreator(user_idea) |
|
app_assets = creator.run_pipeline() |
|
|
|
|
|
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}") |
|
|
|
|
|
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 |
|
} |
|
|
|
|
|
if __name__ == "__main__": |
|
idea = "Build a robot that compliments people when they smile at it." |
|
deploy_robot_app(idea) |
|
|