robosage / app.py
mgbam's picture
Update app.py
0180e60 verified
raw
history blame
1.43 kB
# 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()