Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,10 @@ def inference(image, size):
|
|
| 16 |
if image is None:
|
| 17 |
raise gr.Error("Image not uploaded")
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
if torch.cuda.is_available():
|
| 20 |
torch.cuda.empty_cache()
|
| 21 |
|
|
|
|
| 16 |
if image is None:
|
| 17 |
raise gr.Error("Image not uploaded")
|
| 18 |
|
| 19 |
+
width, height = image.size
|
| 20 |
+
if width >= 5000 or height >= 5000:
|
| 21 |
+
raise gr.Error("The image is too large.")
|
| 22 |
+
|
| 23 |
if torch.cuda.is_available():
|
| 24 |
torch.cuda.empty_cache()
|
| 25 |
|