|
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): |
|
"""Process user idea through the full pipeline""" |
|
creator = VoiceToAppCreator(idea) |
|
app_assets = creator.run_pipeline() |
|
|
|
|
|
title = app_assets["blueprint"].get("title", "RoboApp") |
|
description = app_assets["blueprint"].get("description", "AI-powered robot app.") |
|
|
|
|
|
app_interface = launch_gradio_app(title=title, description=description) |
|
return f"β
{title} App Launched: {description}" |
|
|
|
def create_launcher_interface(): |
|
"""Create the main launcher interface""" |
|
with gr.Blocks(title="RoboSage Creator") as launcher: |
|
gr.Markdown("""# π RoboSage Creator |
|
### Transform your voice idea into a working robot app""") |
|
|
|
with gr.Row(): |
|
idea_input = gr.Textbox( |
|
label="Your Robot Idea", |
|
placeholder="e.g. A healthcare assistant robot...", |
|
lines=3 |
|
) |
|
|
|
with gr.Row(): |
|
launch_btn = gr.Button("Create & Deploy", variant="primary") |
|
status_output = gr.Textbox(label="Creation Status", interactive=False) |
|
|
|
|
|
launch_btn.click( |
|
fn=lambda idea: asyncio.run(handle_user_idea(idea)), |
|
inputs=idea_input, |
|
outputs=status_output |
|
) |
|
|
|
return launcher |
|
|
|
if __name__ == "__main__": |
|
launcher = create_launcher_interface() |
|
launcher.launch( |
|
server_name="0.0.0.0", |
|
server_port=7860, |
|
share=False |
|
) |