Spaces:
Runtime error
Runtime error
Eduard-Sebastian Zamfir
commited on
Commit
•
33e2863
1
Parent(s):
d84aa4f
update
Browse files
app.py
CHANGED
@@ -28,6 +28,12 @@ def dict2namespace(config):
|
|
28 |
|
29 |
def load_img (filename, norm=True,):
|
30 |
img = np.array(Image.open(filename).convert("RGB"))
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
if norm:
|
32 |
img = img / 255.
|
33 |
img = img.astype(np.float32)
|
|
|
28 |
|
29 |
def load_img (filename, norm=True,):
|
30 |
img = np.array(Image.open(filename).convert("RGB"))
|
31 |
+
h, w = img.shape[:2]
|
32 |
+
|
33 |
+
if w > 1920 or h > 1080:
|
34 |
+
new_h, new_w = h // 4, w // 4
|
35 |
+
img = np.array(Image.fromarray(img).resize((new_w, new_h), Image.BICUBIC))
|
36 |
+
|
37 |
if norm:
|
38 |
img = img / 255.
|
39 |
img = img.astype(np.float32)
|