Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,9 +19,6 @@ def inference(image, size):
|
|
| 19 |
if image is None:
|
| 20 |
raise gr.Error("Image not uploaded")
|
| 21 |
|
| 22 |
-
width, height = image.size
|
| 23 |
-
if width >= 5000 or height >= 5000:
|
| 24 |
-
raise gr.Error("The image is too large.")
|
| 25 |
|
| 26 |
if torch.cuda.is_available():
|
| 27 |
torch.cuda.empty_cache()
|
|
@@ -44,6 +41,9 @@ def inference(image, size):
|
|
| 44 |
result = model2.predict(image.convert('RGB'))
|
| 45 |
else:
|
| 46 |
try:
|
|
|
|
|
|
|
|
|
|
| 47 |
result = model8.predict(image.convert('RGB'))
|
| 48 |
except torch.cuda.OutOfMemoryError as e:
|
| 49 |
print(e)
|
|
|
|
| 19 |
if image is None:
|
| 20 |
raise gr.Error("Image not uploaded")
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
if torch.cuda.is_available():
|
| 24 |
torch.cuda.empty_cache()
|
|
|
|
| 41 |
result = model2.predict(image.convert('RGB'))
|
| 42 |
else:
|
| 43 |
try:
|
| 44 |
+
width, height = image.size
|
| 45 |
+
if width >= 5000 or height >= 5000:
|
| 46 |
+
raise gr.Error("The image is too large.")
|
| 47 |
result = model8.predict(image.convert('RGB'))
|
| 48 |
except torch.cuda.OutOfMemoryError as e:
|
| 49 |
print(e)
|