|
import gradio as gr |
|
import asyncio |
|
from core_creator.voice_to_app import VoiceToAppCreator |
|
from deployer.gradio_generator import launch_gradio_app |
|
import os |
|
import logging |
|
|
|
|
|
os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY", "") |
|
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY", "") |
|
|
|
async def process_idea(idea: str): |
|
"""End-to-end idea processing pipeline""" |
|
try: |
|
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.") |
|
|
|
interface = launch_gradio_app(title=title, description=description) |
|
return f"β
{title} launched successfully!" |
|
except Exception as e: |
|
logging.error(f"Processing failed: {e}") |
|
return f"β Error: {str(e)}" |
|
|
|
def create_launcher(): |
|
"""Main launcher interface""" |
|
with gr.Blocks() as launcher: |
|
gr.Markdown("# π RoboSage Creator") |
|
|
|
idea_input = gr.Textbox(label="Your Idea", lines=3) |
|
status_output = gr.Textbox(label="Status", interactive=False) |
|
|
|
gr.Button("Create").click( |
|
fn=lambda idea: asyncio.run(process_idea(idea)), |
|
inputs=idea_input, |
|
outputs=status_output |
|
) |
|
|
|
return launcher |
|
|
|
if __name__ == "__main__": |
|
logging.basicConfig(level=logging.INFO) |
|
app = create_launcher() |
|
app.launch(server_name="0.0.0.0", server_port=7860) |