Update app.py
Browse files
app.py
CHANGED
@@ -3,54 +3,50 @@ import gradio as gr
|
|
3 |
from deployer.gradio_generator import deploy_callback, robot_behavior
|
4 |
|
5 |
def main():
|
6 |
-
|
7 |
-
custom_css = """
|
8 |
-
.gradio-container { max-width: 900px; margin: auto; }
|
9 |
-
.section-header { margin-top: 1.5em; }
|
10 |
-
"""
|
11 |
-
|
12 |
-
with gr.Blocks(css=custom_css) as demo:
|
13 |
gr.Markdown("# π RoboSage\nGenerate your custom robot app, download it, then test it live.")
|
14 |
|
15 |
-
# βββ SECTION 1: Generate & Download App βββββββββββββββββββββββββββββββββββββββββ
|
16 |
-
gr.Markdown("## 1οΈβ£ Generate & Download App", elem_classes="section-header")
|
17 |
-
with gr.Row():
|
18 |
-
idea_in = gr.Textbox(
|
19 |
-
label="Your Robot Idea",
|
20 |
-
placeholder="e.g. A friendly greeting robot.",
|
21 |
-
lines=2,
|
22 |
-
)
|
23 |
-
with gr.Row():
|
24 |
-
gen_btn = gr.Button("Generate App & ZIP")
|
25 |
with gr.Row():
|
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 |
demo.launch(
|
55 |
server_name="0.0.0.0",
|
56 |
server_port=int(os.environ.get("PORT", 7860)),
|
|
|
3 |
from deployer.gradio_generator import deploy_callback, robot_behavior
|
4 |
|
5 |
def main():
|
6 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
gr.Markdown("# π RoboSage\nGenerate your custom robot app, download it, then test it live.")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
with gr.Row():
|
10 |
+
# ββββββββββββββββββββββββββββββββ
|
11 |
+
# 1οΈβ£ Generate & Download App
|
12 |
+
# ββββββββββββββββββββββββββββββββ
|
13 |
+
with gr.Column():
|
14 |
+
gr.Markdown("## 1οΈβ£ Generate & Download App")
|
15 |
+
idea_input = gr.Textbox(
|
16 |
+
lines=2,
|
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 |
+
gen_button.click(
|
25 |
+
fn=deploy_callback,
|
26 |
+
inputs=[idea_input],
|
27 |
+
outputs=[status_output, zip_output],
|
28 |
+
)
|
29 |
+
|
30 |
+
# ββββββββββββββββββββββββββββββββ
|
31 |
+
# 2οΈβ£ Robot Simulator
|
32 |
+
# ββββββββββββββββββββββββββββββββ
|
33 |
+
with gr.Column():
|
34 |
+
gr.Markdown("## 2οΈβ£ Robot Simulator")
|
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 |
+
sim_button.click(
|
44 |
+
fn=robot_behavior,
|
45 |
+
inputs=[cmd_input],
|
46 |
+
outputs=[sim_output],
|
47 |
+
)
|
48 |
+
|
49 |
+
# Launch on 0.0.0.0 for Spaces, default port or override via PORT env
|
50 |
demo.launch(
|
51 |
server_name="0.0.0.0",
|
52 |
server_port=int(os.environ.get("PORT", 7860)),
|