hvoss-techfak commited on
Commit
89f9d38
·
verified ·
1 Parent(s): a3b42e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -698,6 +698,20 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
698
  current_filaments_df_state_val, input_image, *accordion_param_values
699
  ):
700
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701
  # 0. Validate Inputs
702
  if input_image is None:
703
  gr.Error("Input Image is required! Please upload an image.")
 
698
  current_filaments_df_state_val, input_image, *accordion_param_values
699
  ):
700
 
701
+ try:
702
+ _check_quota(90) # same value as @spaces.GPU
703
+ except RuntimeError as exc: # failed → show the full text
704
+ msg = exc_text(exc)
705
+ log_output += f"\nERROR: {msg}\n"
706
+ log_output += "\nThis usually means that your account, your IP adress or the space has no free GPU minutes left, or the process took too long due to too many filaments or changed parameters. Please clone the docker container, run it locally or wait for a bit.\n"
707
+ gr.Error(msg) # red toast
708
+ yield (
709
+ "".join(log_output),
710
+ gr.update(), # keep preview unchanged
711
+ gr.update(),
712
+ )
713
+ return # stop here, no Worker is started
714
+
715
  # 0. Validate Inputs
716
  if input_image is None:
717
  gr.Error("Input Image is required! Please upload an image.")