chrisjcc commited on
Commit
7bf4bdb
·
verified ·
1 Parent(s): d9d9c58

Add Docstring the simulate_and_render function

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -4,16 +4,33 @@ os.environ["MUJOCO_GL"] = "osmesa" # or "egl" if you switch to EGL support
4
  import gradio as gr
5
  from tray_sim import run_tray_simulation
6
 
7
- def simulate_and_render(seed: int, azimuth: float=35, elevation: float=-20, distance: float=1.0):
8
- #gif_path = run_tray_simulation(seed=seed, azimuth=azimuth, elevation=elevation, distance=distance)
9
- #gif_path, stability_flags = run_tray_simulation(seed=seed, azimuth=azimuth, elevation=elevation, distance=distance)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  gif_path, stability_flags, physics_state, llm_friendly_output, json_path = run_tray_simulation(
11
  seed=seed,
12
  azimuth=azimuth,
13
  elevation=elevation,
14
  distance=distance
15
  )
16
- print("Stability: ", stability_flags) # Optional debug
 
 
17
  print("Physics State: ", physics_state)
18
  print("LLM Output: ", llm_friendly_output)
19
  print("JSON Path: ", json_path)
 
4
  import gradio as gr
5
  from tray_sim import run_tray_simulation
6
 
7
+ def simulate_and_render(
8
+ seed: int,
9
+ azimuth: float = 35,
10
+ elevation: float = -20,
11
+ distance: float = 1.0
12
+ ):
13
+ """
14
+ Runs a TraySim simulation with the specified camera parameters and renders the result.
15
+
16
+ Parameters:
17
+ seed (int): Random seed for simulation initialization, affects object placement and dynamics.
18
+ azimuth (float, optional): Horizontal camera angle in degrees. Default is 35.
19
+ elevation (float, optional): Vertical camera angle in degrees. Default is -20.
20
+ distance (float, optional): Distance of the camera from the scene. Default is 1.0.
21
+
22
+ Returns:
23
+ str: Path to the rendered GIF file showing the simulation from the specified viewpoint.
24
+ """
25
  gif_path, stability_flags, physics_state, llm_friendly_output, json_path = run_tray_simulation(
26
  seed=seed,
27
  azimuth=azimuth,
28
  elevation=elevation,
29
  distance=distance
30
  )
31
+
32
+ # Optional debug
33
+ print("Stability: ", stability_flags)
34
  print("Physics State: ", physics_state)
35
  print("LLM Output: ", llm_friendly_output)
36
  print("JSON Path: ", json_path)