cronos3k commited on
Commit
95dda5d
·
verified ·
1 Parent(s): 4241cf4

Update app.py

Browse files

still working on making the interface work with the downloads after generation

Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -375,6 +375,7 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
375
  ],
376
  outputs=[output_buf, video_output],
377
  ).then(
 
378
  lambda: (gr.Button.update(interactive=True), gr.Button.update(interactive=True)),
379
  outputs=[extract_glb_btn, extract_glb_high_quality_btn],
380
  )
@@ -385,10 +386,12 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
385
  inputs=[output_buf, mesh_simplify, texture_size],
386
  outputs=[model_output, glb_bytes_state],
387
  ).then(
388
- lambda glb_bytes: (glb_bytes, ),
 
389
  inputs=[glb_bytes_state],
390
  outputs=[download_glb],
391
  ).then(
 
392
  lambda: gr.DownloadButton.update(interactive=True),
393
  outputs=[download_glb],
394
  )
@@ -399,10 +402,12 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
399
  inputs=[output_buf],
400
  outputs=[model_output, glb_high_quality_bytes_state],
401
  ).then(
402
- lambda glb_bytes: (glb_bytes, ),
 
403
  inputs=[glb_high_quality_bytes_state],
404
  outputs=[download_high_quality_glb],
405
  ).then(
 
406
  lambda: gr.DownloadButton.update(interactive=True),
407
  outputs=[download_high_quality_glb],
408
  )
 
375
  ],
376
  outputs=[output_buf, video_output],
377
  ).then(
378
+ # Enable both Extract GLB buttons after generation
379
  lambda: (gr.Button.update(interactive=True), gr.Button.update(interactive=True)),
380
  outputs=[extract_glb_btn, extract_glb_high_quality_btn],
381
  )
 
386
  inputs=[output_buf, mesh_simplify, texture_size],
387
  outputs=[model_output, glb_bytes_state],
388
  ).then(
389
+ # Map the GLB bytes to the DownloadButton
390
+ lambda glb_bytes: (glb_bytes, "model.glb"),
391
  inputs=[glb_bytes_state],
392
  outputs=[download_glb],
393
  ).then(
394
+ # Enable the Download GLB button
395
  lambda: gr.DownloadButton.update(interactive=True),
396
  outputs=[download_glb],
397
  )
 
402
  inputs=[output_buf],
403
  outputs=[model_output, glb_high_quality_bytes_state],
404
  ).then(
405
+ # Map the high-quality GLB bytes to the DownloadButton
406
+ lambda glb_bytes: (glb_bytes, "model_high_quality.glb"),
407
  inputs=[glb_high_quality_bytes_state],
408
  outputs=[download_high_quality_glb],
409
  ).then(
410
+ # Enable the Download High Quality GLB button
411
  lambda: gr.DownloadButton.update(interactive=True),
412
  outputs=[download_high_quality_glb],
413
  )