File size: 1,428 Bytes
0180e60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4f0212
0180e60
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# app.py - Entry point to run RoboSage App from voice idea to deployment

import gradio as gr
import asyncio
from core_creator.voice_to_app import VoiceToAppCreator
from deployer.gradio_generator import launch_gradio_app
import os

# Optional: configure Gemini/OpenAI keys before launch if needed
os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY", "")
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY", "")

async def handle_user_idea(idea: str):
    creator = VoiceToAppCreator(idea)
    app_assets = creator.run_pipeline()
    app_ui = launch_gradio_app(
        title=app_assets["blueprint"].get("title", "RoboApp"),
        description=app_assets["blueprint"].get("description", "AI-powered robot app.")
    )
    app_ui.launch(share=True)
    return "✅ App Launched"

def run_app():
    with gr.Blocks() as demo:
        gr.Markdown("""# 🚀 RoboSage: Create Your Own Robot App from Voice
Speak or type your robot idea and we’ll generate, simulate, and deploy it live.
        """)
        user_idea = gr.Textbox(label="Your Robot Idea", placeholder="e.g. A robot that reminds me to hydrate.")
        out = gr.Textbox(label="Status")
        launch_btn = gr.Button("Create & Deploy")

        def run_async(idea):
            return asyncio.run(handle_user_idea(idea))

        launch_btn.click(fn=run_async, inputs=user_idea, outputs=out)

    demo.launch()

if __name__ == "__main__":
    run_app()