Update app.py
Browse files
app.py
CHANGED
@@ -3,54 +3,45 @@ import gradio as gr
|
|
3 |
from deployer.gradio_generator import deploy_callback, robot_behavior
|
4 |
|
5 |
def main():
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
gr.Markdown("# π RoboSage\nGenerate your custom robot app, download it, then test it live.")
|
8 |
|
9 |
-
with gr.
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
label="Your Robot Idea",
|
18 |
-
placeholder="e.g. A friendly greeting robot."
|
19 |
-
)
|
20 |
-
gen_button = gr.Button("Generate App & ZIP")
|
21 |
-
status_output = gr.Textbox(label="Status", interactive=False)
|
22 |
-
zip_output = gr.File(label="Download App ZIP")
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
cmd_input = gr.Textbox(
|
36 |
-
lines=1,
|
37 |
-
label="Command",
|
38 |
-
placeholder="say 'hello' or 'You rock!'"
|
39 |
-
)
|
40 |
-
sim_button = gr.Button("Send Command")
|
41 |
-
sim_output = gr.Textbox(label="Robot Response", interactive=False)
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
# Launch
|
50 |
demo.launch(
|
51 |
server_name="0.0.0.0",
|
52 |
server_port=int(os.environ.get("PORT", 7860)),
|
53 |
-
share=False
|
54 |
)
|
55 |
|
56 |
if __name__ == "__main__":
|
|
|
3 |
from deployer.gradio_generator import deploy_callback, robot_behavior
|
4 |
|
5 |
def main():
|
6 |
+
css = """
|
7 |
+
.gradio-container { max-width: 900px; margin: auto; }
|
8 |
+
.section { padding: 1rem; }
|
9 |
+
"""
|
10 |
+
with gr.Blocks(css=css) as demo:
|
11 |
gr.Markdown("# π RoboSage\nGenerate your custom robot app, download it, then test it live.")
|
12 |
|
13 |
+
with gr.Column(elem_id="generate-section"):
|
14 |
+
gr.Markdown("## 1οΈβ£ Generate & Download App")
|
15 |
+
idea_input = gr.Textbox(label="Your Robot Idea",
|
16 |
+
placeholder="e.g. A friendly greeting robot.",
|
17 |
+
lines=2)
|
18 |
+
gen_btn = gr.Button("Generate App & ZIP")
|
19 |
+
status_out = gr.Textbox(label="Status", interactive=False)
|
20 |
+
zip_out = gr.File(label="Download App ZIP")
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
gen_btn.click(
|
23 |
+
fn=deploy_callback,
|
24 |
+
inputs=[idea_input],
|
25 |
+
outputs=[status_out, zip_out],
|
26 |
+
)
|
27 |
|
28 |
+
with gr.Column(elem_id="simulate-section"):
|
29 |
+
gr.Markdown("## 2οΈβ£ Robot Simulator")
|
30 |
+
cmd_input = gr.Textbox(label="Command", placeholder="say 'hello' or 'You rock!'", lines=1)
|
31 |
+
sim_btn = gr.Button("Send Command")
|
32 |
+
sim_out = gr.Textbox(label="Robot Response", interactive=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
sim_btn.click(
|
35 |
+
fn=robot_behavior,
|
36 |
+
inputs=[cmd_input],
|
37 |
+
outputs=[sim_out],
|
38 |
+
)
|
39 |
|
40 |
+
# Launch in Hugging Face or locally
|
41 |
demo.launch(
|
42 |
server_name="0.0.0.0",
|
43 |
server_port=int(os.environ.get("PORT", 7860)),
|
44 |
+
share=False,
|
45 |
)
|
46 |
|
47 |
if __name__ == "__main__":
|