|
|
|
|
|
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}" |
|
|
|
|
|
|
|
def deploy_callback(idea: str) -> str: |
|
return asyncio.run(run_pipeline(idea)) |
|
|
|
|
|
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() |
|
|