Spaces:
Runtime error
Runtime error
Commit
·
397cc99
1
Parent(s):
f3e03bc
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,9 @@ def inference(input_img, is_gray, input_quality, zoom, x_shift, y_shift):
|
|
| 27 |
|
| 28 |
if (input_img_width > 1080) or (input_img_height > 1080):
|
| 29 |
resize_ratio = min(1080/input_img_width, 1080/input_img_height)
|
| 30 |
-
resized_input = Image.fromarray(input_img).resize((int(input_img_width*resize_ratio)
|
|
|
|
|
|
|
| 31 |
input_img = np.array(resized_input)
|
| 32 |
print("input image resized to:", resized_input.size)
|
| 33 |
|
|
@@ -73,9 +75,6 @@ def inference(input_img, is_gray, input_quality, zoom, x_shift, y_shift):
|
|
| 73 |
v.requires_grad = False
|
| 74 |
print("#model.to(device)")
|
| 75 |
model = model.to(device)
|
| 76 |
-
|
| 77 |
-
print("Model loaded.")
|
| 78 |
-
|
| 79 |
print("Model loaded.")
|
| 80 |
|
| 81 |
test_results = OrderedDict()
|
|
|
|
| 27 |
|
| 28 |
if (input_img_width > 1080) or (input_img_height > 1080):
|
| 29 |
resize_ratio = min(1080/input_img_width, 1080/input_img_height)
|
| 30 |
+
resized_input = Image.fromarray(input_img).resize((int(input_img_width*resize_ratio)+(input_img_width*resize_ratio < 1),
|
| 31 |
+
int(input_img_height*resize_ratio)+(input_img_height*resize_ratio < 1)),
|
| 32 |
+
resample=Image.BICUBIC)
|
| 33 |
input_img = np.array(resized_input)
|
| 34 |
print("input image resized to:", resized_input.size)
|
| 35 |
|
|
|
|
| 75 |
v.requires_grad = False
|
| 76 |
print("#model.to(device)")
|
| 77 |
model = model.to(device)
|
|
|
|
|
|
|
|
|
|
| 78 |
print("Model loaded.")
|
| 79 |
|
| 80 |
test_results = OrderedDict()
|