Spaces:
Running
on
L4
Running
on
L4
Update app.py
Browse files
app.py
CHANGED
|
@@ -159,15 +159,15 @@ def inference(image, face_align, background_enhance, face_upsample, upscale, cod
|
|
| 159 |
upscale = 4
|
| 160 |
if upscale > 2 and max(img.shape[:2])>1000: # avoid memory exceeded due to too large img resolution
|
| 161 |
upscale = 2
|
| 162 |
-
if min(img.shape[:2]) >
|
| 163 |
upscale = 1
|
| 164 |
background_enhance = False
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
raise gr.Error(
|
| 170 |
-
"Image resolution is too large (
|
| 171 |
"To keep the demo responsive and avoid long queue times, this case is skipped. "
|
| 172 |
"For such inputs, please deploy this demo locally and remove this limit."
|
| 173 |
)
|
|
|
|
| 159 |
upscale = 4
|
| 160 |
if upscale > 2 and max(img.shape[:2])>1000: # avoid memory exceeded due to too large img resolution
|
| 161 |
upscale = 2
|
| 162 |
+
if min(img.shape[:2]) > 1100 or max(img.shape[:2])>1500: # avoid memory exceeded due to too large img resolution
|
| 163 |
upscale = 1
|
| 164 |
background_enhance = False
|
| 165 |
+
face_upsample = False
|
| 166 |
+
|
| 167 |
+
h, w = img.shape[:2]
|
| 168 |
+
if h * w > 4_000_000: # avoid memory exceeded due to too large img resolution
|
| 169 |
raise gr.Error(
|
| 170 |
+
"Image resolution is too large (>4 megapixels). "
|
| 171 |
"To keep the demo responsive and avoid long queue times, this case is skipped. "
|
| 172 |
"For such inputs, please deploy this demo locally and remove this limit."
|
| 173 |
)
|