Spaces:
Runtime error
Runtime error
Eugene Siow
commited on
Commit
·
9eb308e
1
Parent(s):
884899c
Add max_res parameter.
Browse files
app.py
CHANGED
@@ -40,11 +40,12 @@ def get_model(model_name, scale):
|
|
40 |
|
41 |
|
42 |
def inference(img, scale_str, model_name):
|
|
|
43 |
scale = int(scale_str.replace('x', ''))
|
44 |
width, height = img.size
|
45 |
print(width, height)
|
46 |
-
if width >
|
47 |
-
img = img.thumbnail((
|
48 |
model = get_model(model_name, scale)
|
49 |
try:
|
50 |
inputs = ImageLoader.load_image(img)
|
|
|
40 |
|
41 |
|
42 |
def inference(img, scale_str, model_name):
|
43 |
+
max_res = 1024
|
44 |
scale = int(scale_str.replace('x', ''))
|
45 |
width, height = img.size
|
46 |
print(width, height)
|
47 |
+
if width > max_res or height > max_res:
|
48 |
+
img = img.thumbnail((max_res, max_res), Image.ANTIALIAS)
|
49 |
model = get_model(model_name, scale)
|
50 |
try:
|
51 |
inputs = ImageLoader.load_image(img)
|