Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,10 +137,39 @@ def run(image,Restoration_mode, Colorizaition_mode):
|
|
| 137 |
os.makedirs("Temp/input")
|
| 138 |
print(type(image))
|
| 139 |
h,w,c=image.shape
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
#if h > 800:
|
| 141 |
-
h1 = int(h/2)
|
| 142 |
-
w1 = int(w/2)
|
| 143 |
-
image=cv2.resize(image, dsize=(
|
| 144 |
#max_size=(800,800)
|
| 145 |
#image=image.thumbnail(max_size)
|
| 146 |
#image=np.array(image)
|
|
|
|
| 137 |
os.makedirs("Temp/input")
|
| 138 |
print(type(image))
|
| 139 |
h,w,c=image.shape
|
| 140 |
+
max = 600
|
| 141 |
+
if h>w and h > max:
|
| 142 |
+
r = max / float(h)
|
| 143 |
+
dim = (int(w * r), max)
|
| 144 |
+
elif w>h and w > max:
|
| 145 |
+
r = max / float(w)
|
| 146 |
+
dim = (max, int(h * r))
|
| 147 |
+
else:
|
| 148 |
+
dim = (w,h)
|
| 149 |
+
pass
|
| 150 |
+
'''
|
| 151 |
+
if width is None:
|
| 152 |
+
# calculate the ratio of the height and construct the
|
| 153 |
+
# dimensions
|
| 154 |
+
r = height / float(h)
|
| 155 |
+
dim = (int(w * r), height)
|
| 156 |
+
|
| 157 |
+
# otherwise, the height is None
|
| 158 |
+
else:
|
| 159 |
+
# calculate the ratio of the width and construct the
|
| 160 |
+
# dimensions
|
| 161 |
+
r = width / float(w)
|
| 162 |
+
dim = (width, int(h * r))
|
| 163 |
+
'''
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
|
| 169 |
#if h > 800:
|
| 170 |
+
#h1 = int(h/2)
|
| 171 |
+
#w1 = int(w/2)
|
| 172 |
+
image=cv2.resize(image, dsize=(dim), interpolation=cv2.INTER_LANCZOS4)
|
| 173 |
#max_size=(800,800)
|
| 174 |
#image=image.thumbnail(max_size)
|
| 175 |
#image=np.array(image)
|