feiyang-cai commited on
Commit
a3445fd
·
verified ·
1 Parent(s): b6c1c67

Show ZeroGPU request preflight alert

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py CHANGED
@@ -462,6 +462,27 @@ def ui_clear_design_outputs():
462
  )
463
 
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  def ui_manual_requirements_changed():
466
  return (
467
  "",
@@ -913,6 +934,20 @@ def build_app():
913
  fn=ui_disable_all_buttons,
914
  outputs=[preview_btn, load_btn, design_btn, thermo_btn],
915
  show_progress=False,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
916
  ).then(
917
  fn=ui_inverse_design,
918
  inputs=[n_generate, input_mode, load_test_idx] + input_components,
 
462
  )
463
 
464
 
465
+ def ui_generation_started():
466
+ message = (
467
+ "### Requesting ZeroGPU for candidate generation\n\n"
468
+ "The Space is requesting a temporary CUDA device from Hugging Face ZeroGPU. "
469
+ "If generation stops here or a backend error appears, ZeroGPU allocation likely failed "
470
+ "before CUDA became available, or the account/organization quota is exhausted. "
471
+ "Retry after quota is restored or switch the Space hardware to `Nvidia T4 small`."
472
+ )
473
+ return (
474
+ None,
475
+ "Requesting ZeroGPU allocation...",
476
+ message,
477
+ "Requesting ZeroGPU allocation for candidate generation.",
478
+ gr.update(choices=[], value=None),
479
+ NO_SELECTED_DESIGN,
480
+ "",
481
+ NO_SELECTED_DESIGN,
482
+ THERMO_NOT_RUN,
483
+ )
484
+
485
+
486
  def ui_manual_requirements_changed():
487
  return (
488
  "",
 
934
  fn=ui_disable_all_buttons,
935
  outputs=[preview_btn, load_btn, design_btn, thermo_btn],
936
  show_progress=False,
937
+ ).then(
938
+ fn=ui_generation_started,
939
+ outputs=[
940
+ design_plot,
941
+ design_summary,
942
+ generation_alert,
943
+ run_log,
944
+ design_choice,
945
+ selected_design_md,
946
+ design_payload,
947
+ thermo_selected_md,
948
+ thermo_result_md,
949
+ ],
950
+ show_progress=False,
951
  ).then(
952
  fn=ui_inverse_design,
953
  inputs=[n_generate, input_mode, load_test_idx] + input_components,