Gabriel commited on
Commit
4ed56b9
·
verified ·
1 Parent(s): c05415f

app.py: the startup warm-up catches CUDA and ZeroGPU errors only

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -406,7 +406,7 @@ with gr.Blocks(title="Swedish HTR: TrOCR, MiniCPM-OCR and DSpark") as demo:
406
  if os.environ.get("SPACES_ZERO_GPU"):
407
  try:
408
  _warm_startup()
409
- except Exception as error: # the app still works: the first request warms its own worker
410
  print(f"startup warm-up skipped: {error}", flush=True)
411
 
412
  demo.queue(default_concurrency_limit=2).launch(show_error=True)
 
406
  if os.environ.get("SPACES_ZERO_GPU"):
407
  try:
408
  _warm_startup()
409
+ except (RuntimeError, gr.Error) as error: # CUDA or ZeroGPU: the first request then warms its own worker
410
  print(f"startup warm-up skipped: {error}", flush=True)
411
 
412
  demo.queue(default_concurrency_limit=2).launch(show_error=True)