File size: 1,932 Bytes
798d95e
660b656
 
 
0103479
798d95e
0180e60
0103479
5d3be0e
798d95e
5d3be0e
0103479
 
 
 
 
798d95e
 
0103479
 
 
 
 
798d95e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4f0212
0180e60
0103479
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
57
58
59
60
# app.py - Unified RoboSage Deployer & Simulator (CPU & Spaces-compatible)

import asyncio
import gradio as gr
from core_creator.voice_to_app import VoiceToAppCreator
from deployer.gradio_generator import robot_behavior, launch_gradio_app

async def run_pipeline(idea: str) -> str:
    """
    Runs voice-to-app pipeline and returns a status message.
    """
    creator = VoiceToAppCreator(idea)
    assets = creator.run_pipeline()
    title = assets.get("blueprint", {}).get("title", "<unknown>")
    return f"✅ Generated app: {title}"

# Synchronous wrapper for Gradio

def deploy_callback(idea: str) -> str:
    return asyncio.run(run_pipeline(idea))

# Build unified Gradio interface
with gr.Blocks() as demo:
    gr.Markdown("""
# 🚀 RoboSage
Generate your custom robot app and test it live.
""")

    with gr.Row():
        with gr.Column():
            gr.Markdown("## 1️⃣ Generate App")
            user_idea = gr.Textbox(
                label="Your Robot Idea",
                placeholder="e.g. A friendly greeting robot."
            )
            deploy_btn = gr.Button("Generate App", key="deploy-app-btn")
            deploy_status = gr.Textbox(label="Status", interactive=False)
            deploy_btn.click(
                fn=deploy_callback,
                inputs=[user_idea],
                outputs=[deploy_status]
            )

        with gr.Column():
            gr.Markdown("## 2️⃣ Robot Simulator")
            robot_input = gr.Textbox(
                label="Command",
                placeholder="hello or say You rock!"
            )
            robot_btn = gr.Button("Send", key="simulate-btn")
            robot_output = gr.Textbox(label="Robot Response", lines=4, interactive=False)
            robot_btn.click(
                fn=robot_behavior,
                inputs=[robot_input],
                outputs=[robot_output]
            )

if __name__ == "__main__":
    demo.launch()