Update deployer/gradio_generator.py
Browse files
deployer/gradio_generator.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
import gradio as gr
|
4 |
from deployer.simulator_interface import VirtualRobot
|
5 |
|
|
|
6 |
def robot_behavior(user_input: str) -> str:
|
7 |
"""
|
8 |
Bridge between user input and VirtualRobot actions with basic NLU.
|
@@ -10,7 +11,7 @@ def robot_behavior(user_input: str) -> str:
|
|
10 |
bot = VirtualRobot()
|
11 |
text = user_input.strip().lower()
|
12 |
|
13 |
-
# Greeting detection: wave + greeting
|
14 |
if any(greet in text for greet in ["hello", "hi", "hey", "welcome"]):
|
15 |
return bot.perform_action("wave") + "\n" + bot.perform_action("say Hello there!")
|
16 |
|
@@ -21,6 +22,7 @@ def robot_behavior(user_input: str) -> str:
|
|
21 |
# Fallback for unrecognized commands
|
22 |
return bot.perform_action("say I'm sorry, I didn't understand that.")
|
23 |
|
|
|
24 |
def launch_gradio_app(
|
25 |
title: str = "RoboSage App",
|
26 |
description: str = "Your robot, your voice."
|
@@ -31,7 +33,7 @@ def launch_gradio_app(
|
|
31 |
2. Test your robot in simulator
|
32 |
"""
|
33 |
with gr.Blocks() as demo:
|
34 |
-
gr.Markdown(f"#
|
35 |
|
36 |
# Section: App creation (stubbed)
|
37 |
with gr.Accordion("π¨ Create your robot app", open=True):
|
@@ -56,6 +58,7 @@ def launch_gradio_app(
|
|
56 |
|
57 |
return demo
|
58 |
|
|
|
59 |
if __name__ == "__main__":
|
60 |
app = launch_gradio_app()
|
61 |
app.launch()
|
|
|
3 |
import gradio as gr
|
4 |
from deployer.simulator_interface import VirtualRobot
|
5 |
|
6 |
+
|
7 |
def robot_behavior(user_input: str) -> str:
|
8 |
"""
|
9 |
Bridge between user input and VirtualRobot actions with basic NLU.
|
|
|
11 |
bot = VirtualRobot()
|
12 |
text = user_input.strip().lower()
|
13 |
|
14 |
+
# Greeting detection: wave + friendly greeting
|
15 |
if any(greet in text for greet in ["hello", "hi", "hey", "welcome"]):
|
16 |
return bot.perform_action("wave") + "\n" + bot.perform_action("say Hello there!")
|
17 |
|
|
|
22 |
# Fallback for unrecognized commands
|
23 |
return bot.perform_action("say I'm sorry, I didn't understand that.")
|
24 |
|
25 |
+
|
26 |
def launch_gradio_app(
|
27 |
title: str = "RoboSage App",
|
28 |
description: str = "Your robot, your voice."
|
|
|
33 |
2. Test your robot in simulator
|
34 |
"""
|
35 |
with gr.Blocks() as demo:
|
36 |
+
gr.Markdown(f"# π {title}\n\n{description}")
|
37 |
|
38 |
# Section: App creation (stubbed)
|
39 |
with gr.Accordion("π¨ Create your robot app", open=True):
|
|
|
58 |
|
59 |
return demo
|
60 |
|
61 |
+
|
62 |
if __name__ == "__main__":
|
63 |
app = launch_gradio_app()
|
64 |
app.launch()
|