|
|
|
|
|
import gradio as gr |
|
import asyncio |
|
from core_creator.voice_to_app import VoiceToAppCreator |
|
from deployer.gradio_generator import launch_gradio_app |
|
import os |
|
|
|
|
|
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() |
|
|