File size: 1,553 Bytes
0180e60 37927c4 0180e60 37927c4 0180e60 37927c4 f953fe9 37927c4 f953fe9 37927c4 f953fe9 37927c4 f953fe9 f4f0212 0180e60 37927c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
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
# Configure environment
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) |