Spaces:
Sleeping
Sleeping
Making the GIF Downloadable in Gradio
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ def simulate_and_render(
|
|
| 31 |
run_counter += 1
|
| 32 |
unique_id = f"{seed}_{run_counter}_{int(time.time())}" # Unique identifier for this run
|
| 33 |
|
| 34 |
-
gif_path,physics_state, json_path = run_tray_simulation(
|
| 35 |
seed=seed,
|
| 36 |
azimuth=azimuth,
|
| 37 |
elevation=elevation,
|
|
@@ -72,11 +72,15 @@ with gr.Blocks(
|
|
| 72 |
height=600 # Set default height
|
| 73 |
)
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
# Connect the button to the simulation function
|
| 76 |
submit_button.click(
|
| 77 |
fn=simulate_and_render,
|
| 78 |
inputs=[seed_input, azimuth_input, elevation_input, distance_input],
|
| 79 |
-
outputs=output_image
|
| 80 |
)
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
|
|
|
| 31 |
run_counter += 1
|
| 32 |
unique_id = f"{seed}_{run_counter}_{int(time.time())}" # Unique identifier for this run
|
| 33 |
|
| 34 |
+
gif_path, physics_state, json_path = run_tray_simulation(
|
| 35 |
seed=seed,
|
| 36 |
azimuth=azimuth,
|
| 37 |
elevation=elevation,
|
|
|
|
| 72 |
height=600 # Set default height
|
| 73 |
)
|
| 74 |
|
| 75 |
+
output_file = gr.File(label="Download Simulation GIF")
|
| 76 |
+
state_output = gr.JSON(label="Physics State")
|
| 77 |
+
json_file = gr.File(label="Download Physics State JSON")
|
| 78 |
+
|
| 79 |
# Connect the button to the simulation function
|
| 80 |
submit_button.click(
|
| 81 |
fn=simulate_and_render,
|
| 82 |
inputs=[seed_input, azimuth_input, elevation_input, distance_input],
|
| 83 |
+
outputs=[output_image, output_file, state_output, json_file]
|
| 84 |
)
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|