|
import os |
|
import gradio as gr |
|
from deployer.gradio_generator import deploy_callback, robot_behavior |
|
|
|
def main(): |
|
with gr.Blocks() as demo: |
|
gr.Markdown("# π RoboSage\nGenerate your custom robot app, download it, then test it live.") |
|
|
|
with gr.Row(): |
|
|
|
|
|
|
|
with gr.Column(): |
|
gr.Markdown("## 1οΈβ£ Generate & Download App") |
|
idea_input = gr.Textbox( |
|
lines=2, |
|
label="Your Robot Idea", |
|
placeholder="e.g. A friendly greeting robot." |
|
) |
|
gen_button = gr.Button("Generate App & ZIP") |
|
status_output = gr.Textbox(label="Status", interactive=False) |
|
zip_output = gr.File(label="Download App ZIP") |
|
|
|
gen_button.click( |
|
fn=deploy_callback, |
|
inputs=[idea_input], |
|
outputs=[status_output, zip_output], |
|
) |
|
|
|
|
|
|
|
|
|
with gr.Column(): |
|
gr.Markdown("## 2οΈβ£ Robot Simulator") |
|
cmd_input = gr.Textbox( |
|
lines=1, |
|
label="Command", |
|
placeholder="say 'hello' or 'You rock!'" |
|
) |
|
sim_button = gr.Button("Send Command") |
|
sim_output = gr.Textbox(label="Robot Response", interactive=False) |
|
|
|
sim_button.click( |
|
fn=robot_behavior, |
|
inputs=[cmd_input], |
|
outputs=[sim_output], |
|
) |
|
|
|
|
|
demo.launch( |
|
server_name="0.0.0.0", |
|
server_port=int(os.environ.get("PORT", 7860)), |
|
share=False |
|
) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|