Update app.py
Browse files
app.py
CHANGED
|
@@ -116,7 +116,7 @@ def load_img(filename, norm=True):
|
|
| 116 |
|
| 117 |
|
| 118 |
def inference(image, upscale, large_input_flag, color_fix):
|
| 119 |
-
if upscale is None or not isinstance(upscale, (int, float)) or upscale == 3
|
| 120 |
upscale = 2
|
| 121 |
|
| 122 |
upscale = int(upscale) # convert type to int
|
|
@@ -165,14 +165,12 @@ def inference(image, upscale, large_input_flag, color_fix):
|
|
| 165 |
output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))
|
| 166 |
output = (output * 255.0).round().astype(np.uint8)
|
| 167 |
|
| 168 |
-
return img, Image.fromarray(output)
|
| 169 |
-
|
| 170 |
# # save restored img
|
| 171 |
# save_path = f'results/out.png'
|
| 172 |
# cv2.imwrite(save_path, output)
|
| 173 |
|
| 174 |
# output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
|
| 175 |
-
|
| 176 |
|
| 177 |
|
| 178 |
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
def inference(image, upscale, large_input_flag, color_fix):
|
| 119 |
+
if upscale is None or not isinstance(upscale, (int, float)) or upscale == 3.:
|
| 120 |
upscale = 2
|
| 121 |
|
| 122 |
upscale = int(upscale) # convert type to int
|
|
|
|
| 165 |
output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))
|
| 166 |
output = (output * 255.0).round().astype(np.uint8)
|
| 167 |
|
|
|
|
|
|
|
| 168 |
# # save restored img
|
| 169 |
# save_path = f'results/out.png'
|
| 170 |
# cv2.imwrite(save_path, output)
|
| 171 |
|
| 172 |
# output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
|
| 173 |
+
return Image.fromarray(output), img
|
| 174 |
|
| 175 |
|
| 176 |
|