CyGuy8 commited on
Commit
96fe51b
·
1 Parent(s): f6a0b87

Add manual model regeneration button

Browse files
Files changed (1) hide show
  1. app.py +11 -18
app.py CHANGED
@@ -2033,6 +2033,12 @@ def build_demo() -> gr.Blocks:
2033
  label="Scale STLs",
2034
  value=False,
2035
  )
 
 
 
 
 
 
2036
 
2037
  with gr.Group(visible=False) as scaling_details_group:
2038
  with gr.Row():
@@ -2307,10 +2313,6 @@ def build_demo() -> gr.Blocks:
2307
  inputs=[stl_file, scale_to_target, scale_mode, target_xs[i], target_ys[i], target_zs[i]],
2308
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2309
  queue=False,
2310
- ).then(
2311
- fn=refresh_all_model_viewers,
2312
- inputs=refresh_inputs,
2313
- outputs=refresh_outputs,
2314
  )
2315
  target_ys[i].change(
2316
  fn=lambda stl, enabled, mode, x, y, z: sync_uniform_target_dimensions(
@@ -2319,10 +2321,6 @@ def build_demo() -> gr.Blocks:
2319
  inputs=[stl_file, scale_to_target, scale_mode, target_xs[i], target_ys[i], target_zs[i]],
2320
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2321
  queue=False,
2322
- ).then(
2323
- fn=refresh_all_model_viewers,
2324
- inputs=refresh_inputs,
2325
- outputs=refresh_outputs,
2326
  )
2327
  target_zs[i].change(
2328
  fn=lambda stl, enabled, mode, x, y, z: sync_uniform_target_dimensions(
@@ -2331,10 +2329,6 @@ def build_demo() -> gr.Blocks:
2331
  inputs=[stl_file, scale_to_target, scale_mode, target_xs[i], target_ys[i], target_zs[i]],
2332
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2333
  queue=False,
2334
- ).then(
2335
- fn=refresh_all_model_viewers,
2336
- inputs=refresh_inputs,
2337
- outputs=refresh_outputs,
2338
  )
2339
  scale_to_target.change(
2340
  fn=lambda stl, enabled, mode, x, y, z: sync_uniform_target_dimensions(
@@ -2368,12 +2362,11 @@ def build_demo() -> gr.Blocks:
2368
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2369
  queue=False,
2370
  )
2371
- for scale_control in (scale_to_target, scale_mode):
2372
- scale_control.change(
2373
- fn=refresh_all_model_viewers,
2374
- inputs=refresh_inputs,
2375
- outputs=refresh_outputs,
2376
- )
2377
 
2378
  generate_button.click(
2379
  fn=generate_all_stacks,
 
2033
  label="Scale STLs",
2034
  value=False,
2035
  )
2036
+ with gr.Column(scale=0, min_width=180):
2037
+ regenerate_models_button = gr.Button(
2038
+ "Regenerate Images",
2039
+ variant="secondary",
2040
+ size="sm",
2041
+ )
2042
 
2043
  with gr.Group(visible=False) as scaling_details_group:
2044
  with gr.Row():
 
2313
  inputs=[stl_file, scale_to_target, scale_mode, target_xs[i], target_ys[i], target_zs[i]],
2314
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2315
  queue=False,
 
 
 
 
2316
  )
2317
  target_ys[i].change(
2318
  fn=lambda stl, enabled, mode, x, y, z: sync_uniform_target_dimensions(
 
2321
  inputs=[stl_file, scale_to_target, scale_mode, target_xs[i], target_ys[i], target_zs[i]],
2322
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2323
  queue=False,
 
 
 
 
2324
  )
2325
  target_zs[i].change(
2326
  fn=lambda stl, enabled, mode, x, y, z: sync_uniform_target_dimensions(
 
2329
  inputs=[stl_file, scale_to_target, scale_mode, target_xs[i], target_ys[i], target_zs[i]],
2330
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2331
  queue=False,
 
 
 
 
2332
  )
2333
  scale_to_target.change(
2334
  fn=lambda stl, enabled, mode, x, y, z: sync_uniform_target_dimensions(
 
2362
  outputs=[target_xs[i], target_ys[i], target_zs[i]],
2363
  queue=False,
2364
  )
2365
+ regenerate_models_button.click(
2366
+ fn=refresh_all_model_viewers,
2367
+ inputs=refresh_inputs,
2368
+ outputs=refresh_outputs,
2369
+ )
 
2370
 
2371
  generate_button.click(
2372
  fn=generate_all_stacks,