zhiweili
commited on
Commit
·
34afbba
1
Parent(s):
981b92f
limit size
Browse files- app_enhance.py +9 -0
app_enhance.py
CHANGED
@@ -70,6 +70,15 @@ def enhance_image(
|
|
70 |
# h, w = img.shape[0:2]
|
71 |
# output = cv2.resize(output, (int(w * scale / 2), int(h * scale / 2)), interpolation=interpolation)
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
enhanced_image = Image.fromarray(cv2.cvtColor(output, cv2.COLOR_BGR2RGB))
|
74 |
tmpPrefix = "/tmp/gradio/"
|
75 |
|
|
|
70 |
# h, w = img.shape[0:2]
|
71 |
# output = cv2.resize(output, (int(w * scale / 2), int(h * scale / 2)), interpolation=interpolation)
|
72 |
|
73 |
+
max_size = 3480
|
74 |
+
if h > max_size:
|
75 |
+
w = int(w * max_size / h)
|
76 |
+
h = max_size
|
77 |
+
|
78 |
+
if w > max_size:
|
79 |
+
h = int(h * max_size / w)
|
80 |
+
w = max_size
|
81 |
+
|
82 |
enhanced_image = Image.fromarray(cv2.cvtColor(output, cv2.COLOR_BGR2RGB))
|
83 |
tmpPrefix = "/tmp/gradio/"
|
84 |
|