File size: 1,907 Bytes
0180e60
 
 
 
 
 
f953fe9
0180e60
 
 
 
f953fe9
0180e60
 
f953fe9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4f0212
0180e60
f953fe9
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
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
    )