mgbam commited on
Commit
8516b0f
·
verified ·
1 Parent(s): dab61c8

Update deployer/gradio_generator.py

Browse files
Files changed (1) hide show
  1. deployer/gradio_generator.py +8 -8
deployer/gradio_generator.py CHANGED
@@ -3,14 +3,16 @@ from .simulator_interface import VirtualRobot
3
  import logging
4
 
5
  class RoboSageApp:
6
- def __init__(self):
7
  self.robot = VirtualRobot()
 
 
8
  self.logger = logging.getLogger(__name__)
9
  self.interface = self._build_interface()
10
 
11
  def _build_interface(self) -> gr.Blocks:
12
- with gr.Blocks(title="RoboSage") as interface:
13
- gr.Markdown("# 🤖 RoboSage Assistant")
14
 
15
  with gr.Row():
16
  input_txt = gr.Textbox(label="Command", placeholder="Try 'wave' or 'say hello'")
@@ -27,12 +29,10 @@ class RoboSageApp:
27
 
28
  return interface
29
 
30
- # The exported function name must match what's imported
31
- def launch_gradio_app() -> gr.Blocks:
32
- """The function that app.py imports must have this exact name"""
33
- return RoboSageApp().interface
34
 
35
- # For local testing
36
  if __name__ == "__main__":
37
  logging.basicConfig(level=logging.INFO)
38
  app = launch_gradio_app()
 
3
  import logging
4
 
5
  class RoboSageApp:
6
+ def __init__(self, title="RoboSage", description="Your virtual assistant"):
7
  self.robot = VirtualRobot()
8
+ self.title = title
9
+ self.description = description
10
  self.logger = logging.getLogger(__name__)
11
  self.interface = self._build_interface()
12
 
13
  def _build_interface(self) -> gr.Blocks:
14
+ with gr.Blocks(title=self.title) as interface:
15
+ gr.Markdown(f"# 🤖 {self.title}\n\n{self.description}")
16
 
17
  with gr.Row():
18
  input_txt = gr.Textbox(label="Command", placeholder="Try 'wave' or 'say hello'")
 
29
 
30
  return interface
31
 
32
+ def launch_gradio_app(title="RoboSage", description="Your virtual assistant") -> gr.Blocks:
33
+ """Now accepts title and description parameters"""
34
+ return RoboSageApp(title=title, description=description).interface
 
35
 
 
36
  if __name__ == "__main__":
37
  logging.basicConfig(level=logging.INFO)
38
  app = launch_gradio_app()