Spaces:
Running
on
A10G
Running
on
A10G
Xintao
commited on
Commit
•
eef4068
1
Parent(s):
c21c011
robust to scale input
Browse files
app.py
CHANGED
@@ -64,10 +64,13 @@ def inference(img, version, scale):
|
|
64 |
else:
|
65 |
|
66 |
extension = 'png'
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
71 |
if img_mode == 'RGBA': # RGBA images should be saved in png format
|
72 |
extension = 'png'
|
73 |
else:
|
|
|
64 |
else:
|
65 |
|
66 |
extension = 'png'
|
67 |
+
try:
|
68 |
+
if scale != 2:
|
69 |
+
interpolation = cv2.INTER_AREA if scale < 2 else cv2.INTER_LANCZOS4
|
70 |
+
h, w = img.shape[0:2]
|
71 |
+
output = cv2.resize(output, (int(w * scale /2), int(h * scale/2)), interpolation=interpolation)
|
72 |
+
except:
|
73 |
+
print('wrong scale input')
|
74 |
if img_mode == 'RGBA': # RGBA images should be saved in png format
|
75 |
extension = 'png'
|
76 |
else:
|