chrisjcc commited on
Commit
cdee8ac
·
verified ·
1 Parent(s): 5f01901

Modify the Gradio interface to handle the unique file paths and ensure the display updates correctly.

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -4,6 +4,11 @@ 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(
8
  seed: int,
9
  azimuth: float = 35,
@@ -26,7 +31,8 @@ def simulate_and_render(
26
  seed=seed,
27
  azimuth=azimuth,
28
  elevation=elevation,
29
- distance=distance
 
30
  )
31
 
32
  # Optional debug
@@ -53,8 +59,7 @@ def simulate_and_render(
53
  # Define the custom layout using Blocks
54
  with gr.Blocks(
55
  css="""#simulation_image {min-height: 600px; min-width: 700px;}""", # Set minimum size for the image
56
- theme=gr.themes.Default(),
57
- cache_examples=False
58
  ) as iface:
59
  gr.Markdown("# TraySim Simulation Viewer")
60
  gr.Markdown("Simulates object drop on a tray using MuJoCo and shows the result as a GIF.")
 
4
  import gradio as gr
5
  from tray_sim import run_tray_simulation
6
 
7
+ import time # For unique file naming
8
+
9
+ # Global counter for unique file naming
10
+ run_counter = 0
11
+
12
  def simulate_and_render(
13
  seed: int,
14
  azimuth: float = 35,
 
31
  seed=seed,
32
  azimuth=azimuth,
33
  elevation=elevation,
34
+ distance=distance,
35
+ unique_id=unique_id # Pass unique_id to avoid file conflicts
36
  )
37
 
38
  # Optional debug
 
59
  # Define the custom layout using Blocks
60
  with gr.Blocks(
61
  css="""#simulation_image {min-height: 600px; min-width: 700px;}""", # Set minimum size for the image
62
+ theme=gr.themes.Default()
 
63
  ) as iface:
64
  gr.Markdown("# TraySim Simulation Viewer")
65
  gr.Markdown("Simulates object drop on a tray using MuJoCo and shows the result as a GIF.")