Spaces:
Running
on
Zero
Running
on
Zero
get error
Browse files
app.py
CHANGED
@@ -13,12 +13,16 @@ model8.load_weights('weights/RealESRGAN_x8.pth', download=True)
|
|
13 |
|
14 |
|
15 |
def inference(image: Image, size: str) -> Image:
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
return result
|
23 |
|
24 |
|
|
|
13 |
|
14 |
|
15 |
def inference(image: Image, size: str) -> Image:
|
16 |
+
try:
|
17 |
+
if size == '2x':
|
18 |
+
result = model2.predict(image.convert('RGB'))
|
19 |
+
elif size == '4x':
|
20 |
+
result = model4.predict(image.convert('RGB'))
|
21 |
+
else:
|
22 |
+
result = model8.predict(image.convert('RGB'))
|
23 |
+
except Exception as e:
|
24 |
+
print(e)
|
25 |
+
raise gr.Error(str(e))
|
26 |
return result
|
27 |
|
28 |
|