Spaces:
Sleeping
Sleeping
Commit ·
c17f158
1
Parent(s): 71a73d4
Fix ZeroGPU timeout by increasing limit and lowering max image size
Browse files
app.py
CHANGED
|
@@ -42,13 +42,13 @@ except Exception as e:
|
|
| 42 |
# ZERO-GPU INFERENCE WRAPPERS
|
| 43 |
# ============================================================
|
| 44 |
|
| 45 |
-
@spaces.GPU
|
| 46 |
def infer_hatsat(image):
|
| 47 |
if hatsat_model is None:
|
| 48 |
raise RuntimeError("HATSAT model is not loaded.")
|
| 49 |
return hatsat_model.predict(image)
|
| 50 |
|
| 51 |
-
@spaces.GPU
|
| 52 |
def infer_esrgan(image):
|
| 53 |
if esrgan_model is None:
|
| 54 |
raise RuntimeError("ESRGAN model is not loaded.")
|
|
@@ -258,10 +258,10 @@ def run_super_resolution(image, model_choice, progress=gr.Progress()):
|
|
| 258 |
"Please upload an image at least 16×16 pixels."
|
| 259 |
)
|
| 260 |
|
| 261 |
-
if input_w >
|
| 262 |
raise gr.Error(
|
| 263 |
f"⚠️ Image too large ({input_w}×{input_h}). "
|
| 264 |
-
"For
|
| 265 |
)
|
| 266 |
|
| 267 |
# --------------------------------------------------------
|
|
|
|
| 42 |
# ZERO-GPU INFERENCE WRAPPERS
|
| 43 |
# ============================================================
|
| 44 |
|
| 45 |
+
@spaces.GPU(duration=120)
|
| 46 |
def infer_hatsat(image):
|
| 47 |
if hatsat_model is None:
|
| 48 |
raise RuntimeError("HATSAT model is not loaded.")
|
| 49 |
return hatsat_model.predict(image)
|
| 50 |
|
| 51 |
+
@spaces.GPU(duration=120)
|
| 52 |
def infer_esrgan(image):
|
| 53 |
if esrgan_model is None:
|
| 54 |
raise RuntimeError("ESRGAN model is not loaded.")
|
|
|
|
| 258 |
"Please upload an image at least 16×16 pixels."
|
| 259 |
)
|
| 260 |
|
| 261 |
+
if input_w > 1024 or input_h > 1024:
|
| 262 |
raise gr.Error(
|
| 263 |
f"⚠️ Image too large ({input_w}×{input_h}). "
|
| 264 |
+
"For this web demo, please use images up to 1024×1024 pixels to prevent GPU timeouts."
|
| 265 |
)
|
| 266 |
|
| 267 |
# --------------------------------------------------------
|