mgbam commited on
Commit
c668a21
Β·
verified Β·
1 Parent(s): 51b18cb

Update deployer/gradio_generator.py

Browse files
Files changed (1) hide show
  1. deployer/gradio_generator.py +11 -12
deployer/gradio_generator.py CHANGED
@@ -7,7 +7,7 @@ from deployer.revenue_tracker import package_artifacts
7
 
8
  async def generate_app_async(idea: str):
9
  """
10
- Runs the voice-to-app pipeline and packages the app, returning status and ZIP path.
11
  """
12
  creator = VoiceToAppCreator(idea)
13
  assets = creator.run_pipeline()
@@ -19,27 +19,28 @@ async def generate_app_async(idea: str):
19
 
20
  def deploy_callback(idea: str):
21
  """
22
- Synchronous wrapper for Gradio.
 
23
  """
24
  return asyncio.run(generate_app_async(idea))
25
 
26
 
27
  def robot_behavior(command: str) -> str:
28
  """
29
- Simulate robot action based on a text command.
30
  """
31
  return VirtualRobot().perform_action(command)
32
 
33
 
34
- def launch_gradio_app():
35
  """
36
- Build and return the Gradio interface.
37
  """
38
  with gr.Blocks() as demo:
39
  gr.Markdown("# πŸš€ RoboSage\nGenerate your custom robot app and test it live.")
40
 
41
  with gr.Row():
42
- # Generate & Download
43
  with gr.Column():
44
  gr.Markdown("## 1️⃣ Generate & Download App")
45
  idea_input = gr.Textbox(
@@ -57,7 +58,7 @@ def launch_gradio_app():
57
  outputs=[status_out, zip_out]
58
  )
59
 
60
- # Simulator
61
  with gr.Column():
62
  gr.Markdown("## πŸ€– Robot Simulator")
63
  cmd_input = gr.Textbox(
@@ -74,13 +75,11 @@ def launch_gradio_app():
74
  outputs=[sim_out]
75
  )
76
 
77
- return demo
78
-
79
-
80
- if __name__ == "__main__":
81
- demo = launch_gradio_app()
82
  demo.launch(
83
  server_name="0.0.0.0",
84
  server_port=int(os.environ.get("PORT", 7860)),
85
  share=False
86
  )
 
 
 
 
7
 
8
  async def generate_app_async(idea: str):
9
  """
10
+ Run the voice-to-app pipeline asynchronously and return a tuple of (status_message, zip_path).
11
  """
12
  creator = VoiceToAppCreator(idea)
13
  assets = creator.run_pipeline()
 
19
 
20
  def deploy_callback(idea: str):
21
  """
22
+ Synchronous wrapper for Gradio: generates the app and packages it into a ZIP.
23
+ Returns (status_message, zip_path).
24
  """
25
  return asyncio.run(generate_app_async(idea))
26
 
27
 
28
  def robot_behavior(command: str) -> str:
29
  """
30
+ Simulate robot behavior based on a text command.
31
  """
32
  return VirtualRobot().perform_action(command)
33
 
34
 
35
+ def main():
36
  """
37
+ Build and launch the Gradio UI for RoboSage.
38
  """
39
  with gr.Blocks() as demo:
40
  gr.Markdown("# πŸš€ RoboSage\nGenerate your custom robot app and test it live.")
41
 
42
  with gr.Row():
43
+ # Generate & Download App Section
44
  with gr.Column():
45
  gr.Markdown("## 1️⃣ Generate & Download App")
46
  idea_input = gr.Textbox(
 
58
  outputs=[status_out, zip_out]
59
  )
60
 
61
+ # Robot Simulator Section
62
  with gr.Column():
63
  gr.Markdown("## πŸ€– Robot Simulator")
64
  cmd_input = gr.Textbox(
 
75
  outputs=[sim_out]
76
  )
77
 
 
 
 
 
 
78
  demo.launch(
79
  server_name="0.0.0.0",
80
  server_port=int(os.environ.get("PORT", 7860)),
81
  share=False
82
  )
83
+
84
+ if __name__ == "__main__":
85
+ main()