File size: 972 Bytes
a8f1886
ea3d5fc
 
 
 
a8f1886
 
 
ea3d5fc
a8f1886
 
 
6b0956e
a8f1886
 
 
6b0956e
a8f1886
 
 
6b0956e
a8f1886
ea3d5fc
a8f1886
ea3d5fc
 
a8f1886
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
# gradio_generator.py - Launches the Gradio UI for robot app deployment

import gradio as gr
from core_creator.voice_to_app import VoiceToAppCreator

def deploy_callback(user_input: str) -> dict:
    creator = VoiceToAppCreator(user_input)
    return creator.run_pipeline()

def robot_behavior(user_input: str) -> str:
    result = deploy_callback(user_input)
    return result.get("code", "No code generated.")

def launch_gradio_interface():
    with gr.Blocks() as demo:
        gr.Markdown("# 🤖 Voice-to-Robot App Generator")
        with gr.Row():
            input_box = gr.Textbox(label="Describe your robot idea", placeholder="e.g., A robot that helps kids brush their teeth.")
            output_box = gr.Code(label="Generated Code", language="python")
        submit_btn = gr.Button("Generate App")

        submit_btn.click(fn=robot_behavior, inputs=input_box, outputs=output_box)

    demo.launch()

if __name__ == "__main__":
    launch_gradio_interface()