robosage / app.py
mgbam's picture
Update app.py
f953fe9 verified
raw
history blame
1.91 kB
import gradio as gr
import asyncio
from core_creator.voice_to_app import VoiceToAppCreator
from deployer.gradio_generator import launch_gradio_app
import os
# Configure API keys
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()
# Get title/description from blueprint or use defaults
title = app_assets["blueprint"].get("title", "RoboApp")
description = app_assets["blueprint"].get("description", "AI-powered robot app.")
# Launch the app interface
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)
# Event handling
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
)