File size: 2,356 Bytes
d078b7e
181f321
88f811c
1b36f73
88f811c
e8ee41e
d1faaf8
e8ee41e
 
70154bd
1b36f73
 
70154bd
e8ee41e
 
 
181f321
e8ee41e
1b36f73
e8ee41e
1b36f73
e8ee41e
50d96bd
e8ee41e
70154bd
e8ee41e
70154bd
e8ee41e
 
70154bd
 
e8ee41e
 
1b36f73
e8ee41e
 
 
70154bd
e8ee41e
 
 
70154bd
e8ee41e
1b36f73
e8ee41e
 
1b36f73
 
e8ee41e
 
 
 
 
 
70154bd
e8ee41e
 
1b36f73
e8ee41e
70154bd
e8ee41e
 
70154bd
181f321
 
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
61
62
63
64
65
66
import gradio as gr
from core_creator.voice_to_app import VoiceToAppCreator
from deployer.simulator_interface import VirtualRobot
from deployer.revenue_tracker import package_artifacts

def deploy_callback(idea: str):
    """
    Generates the app based on the provided idea and packages it into a ZIP file.
    Returns a status message and the path to the ZIP file.
    """
    creator = VoiceToAppCreator(idea)
    assets = creator.run_pipeline()
    title = assets.get("blueprint", {}).get("title", "<unknown>")
    zip_path = package_artifacts(assets)
    status_msg = f"βœ… Generated app: {title}"
    return status_msg, zip_path

def robot_behavior(command: str) -> str:
    """
    Simulates robot action based on a text command.
    """
    return VirtualRobot().perform_action(command)

def launch_gradio_app():
    """
    Builds and returns the Gradio Blocks UI for the RoboSage app.
    """
    with gr.Blocks() as demo:
        gr.Markdown("# πŸ€– RoboSage: Your Personal Robot App Generator")

        with gr.Row():
            with gr.Column():
                gr.Markdown("### πŸ› οΈ Generate Your Robot App")
                idea_input = gr.Textbox(
                    label="Enter your robot idea",
                    placeholder="e.g., A friendly greeting robot.",
                    lines=2
                )
                generate_button = gr.Button("Generate App")
                status_output = gr.Textbox(label="Status", interactive=False)
                download_output = gr.File(label="Download App ZIP")

                generate_button.click(
                    fn=deploy_callback,
                    inputs=idea_input,
                    outputs=[status_output, download_output]
                )

            with gr.Column():
                gr.Markdown("### πŸ€– Robot Simulator")
                command_input = gr.Textbox(
                    label="Enter command",
                    placeholder="e.g., say Hello World!",
                    lines=1
                )
                send_button = gr.Button("Send Command")
                response_output = gr.Textbox(label="Robot Response", interactive=False)

                send_button.click(
                    fn=robot_behavior,
                    inputs=command_input,
                    outputs=response_output
                )

    return demo