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

Update deployer/gradio_generator.py

Browse files
Files changed (1) hide show
  1. deployer/gradio_generator.py +16 -16
deployer/gradio_generator.py CHANGED
@@ -5,9 +5,9 @@ from core_creator.voice_to_app import VoiceToAppCreator
5
  from deployer.simulator_interface import VirtualRobot
6
  from deployer.revenue_tracker import package_artifacts
7
 
8
- async def _generate_app_async(idea: str):
9
  """
10
- Run the VoiceToApp pipeline asynchronously and return status + ZIP path.
11
  """
12
  creator = VoiceToAppCreator(idea)
13
  assets = creator.run_pipeline()
@@ -19,9 +19,9 @@ async def _generate_app_async(idea: str):
19
 
20
  def deploy_callback(idea: str):
21
  """
22
- Synchronous wrapper for Gradio: generate and package app.
23
  """
24
- return asyncio.run(_generate_app_async(idea))
25
 
26
 
27
  def robot_behavior(command: str) -> str:
@@ -33,22 +33,17 @@ def robot_behavior(command: str) -> str:
33
 
34
  def launch_gradio_app():
35
  """
36
- Build and return the Gradio Blocks UI for the RoboSage app.
37
  """
38
- css = r"""
39
- .gradio-container { max-width: 900px; margin: auto; }
40
- .section { padding: 1rem; }
41
- """
42
-
43
- demo = gr.Blocks(css=css)
44
- with demo:
45
- gr.Markdown("# πŸš€ RoboSage\nGenerate and simulate your custom robot app.")
46
 
47
  with gr.Row():
 
48
  with gr.Column():
49
- gr.Markdown("## πŸ› οΈ Generate & Download App")
50
  idea_input = gr.Textbox(
51
- label="Robot Idea",
52
  placeholder="e.g. A friendly greeting robot.",
53
  lines=2
54
  )
@@ -62,6 +57,7 @@ def launch_gradio_app():
62
  outputs=[status_out, zip_out]
63
  )
64
 
 
65
  with gr.Column():
66
  gr.Markdown("## πŸ€– Robot Simulator")
67
  cmd_input = gr.Textbox(
@@ -83,4 +79,8 @@ def launch_gradio_app():
83
 
84
  if __name__ == "__main__":
85
  demo = launch_gradio_app()
86
- demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)), share=False)
 
 
 
 
 
5
  from deployer.simulator_interface import VirtualRobot
6
  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
 
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:
 
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(
46
+ label="Your Robot Idea",
47
  placeholder="e.g. A friendly greeting robot.",
48
  lines=2
49
  )
 
57
  outputs=[status_out, zip_out]
58
  )
59
 
60
+ # Simulator
61
  with gr.Column():
62
  gr.Markdown("## πŸ€– Robot Simulator")
63
  cmd_input = gr.Textbox(
 
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
+ )