Update app.py
Browse files
app.py
CHANGED
@@ -1,77 +1,54 @@
|
|
1 |
# app.py
|
2 |
-
# Unified RoboSage Deployer & Simulator (CPU & Spaces-compatible)
|
3 |
|
4 |
-
import asyncio
|
5 |
import gradio as gr
|
6 |
-
from deployer.gradio_generator import robot_behavior,
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
label="
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
deploy_btn.click(
|
54 |
-
fn=deploy_callback,
|
55 |
-
inputs=[user_idea],
|
56 |
-
outputs=[deploy_status, download_zip]
|
57 |
-
)
|
58 |
-
|
59 |
-
with gr.Column(scale=1):
|
60 |
-
gr.Markdown("## 2οΈβ£ Robot Simulator", elem_classes="section")
|
61 |
-
robot_input = gr.Textbox(
|
62 |
-
label="Speak or Type Command",
|
63 |
-
placeholder="hello or say You rock!",
|
64 |
-
lines=1
|
65 |
-
)
|
66 |
-
robot_btn = gr.Button("Send")
|
67 |
-
robot_output = gr.Textbox(label="Robot Response", lines=4, interactive=False)
|
68 |
-
|
69 |
-
robot_btn.click(
|
70 |
-
fn=simulator_callback,
|
71 |
-
inputs=[robot_input],
|
72 |
-
outputs=[robot_output]
|
73 |
-
)
|
74 |
|
75 |
if __name__ == "__main__":
|
76 |
-
|
77 |
-
|
|
|
1 |
# app.py
|
|
|
2 |
|
|
|
3 |
import gradio as gr
|
4 |
+
from deployer.gradio_generator import deploy_callback, robot_behavior, download_callback
|
5 |
+
|
6 |
+
def launch_gradio_app():
|
7 |
+
with gr.Blocks() as demo:
|
8 |
+
gr.Markdown("# π€ RoboSage: Your Personal Robot App Generator")
|
9 |
+
|
10 |
+
with gr.Row():
|
11 |
+
with gr.Column():
|
12 |
+
gr.Markdown("### π οΈ Generate Your Robot App")
|
13 |
+
idea_input = gr.Textbox(
|
14 |
+
label="Enter your robot idea",
|
15 |
+
placeholder="e.g., A friendly greeting robot.",
|
16 |
+
lines=2
|
17 |
+
)
|
18 |
+
generate_button = gr.Button("Generate App")
|
19 |
+
status_output = gr.Textbox(label="Status", interactive=False)
|
20 |
+
generate_button.click(
|
21 |
+
fn=deploy_callback,
|
22 |
+
inputs=idea_input,
|
23 |
+
outputs=status_output
|
24 |
+
)
|
25 |
+
|
26 |
+
gr.Markdown("### π¦ Download Your App")
|
27 |
+
download_button = gr.Button("Download App ZIP")
|
28 |
+
download_output = gr.File(label="Download ZIP")
|
29 |
+
download_button.click(
|
30 |
+
fn=download_callback,
|
31 |
+
inputs=None,
|
32 |
+
outputs=download_output
|
33 |
+
)
|
34 |
+
|
35 |
+
with gr.Column():
|
36 |
+
gr.Markdown("### π€ Robot Simulator")
|
37 |
+
command_input = gr.Textbox(
|
38 |
+
label="Enter command",
|
39 |
+
placeholder="e.g., say Hello World!",
|
40 |
+
lines=1
|
41 |
+
)
|
42 |
+
send_button = gr.Button("Send Command")
|
43 |
+
response_output = gr.Textbox(label="Robot Response", interactive=False)
|
44 |
+
send_button.click(
|
45 |
+
fn=robot_behavior,
|
46 |
+
inputs=command_input,
|
47 |
+
outputs=response_output
|
48 |
+
)
|
49 |
+
|
50 |
+
return demo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
if __name__ == "__main__":
|
53 |
+
app = launch_gradio_app()
|
54 |
+
app.launch()
|