Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -182,6 +182,16 @@ ocr_id = {
|
|
182 |
def blur_im(img,bounds,target_lang,trans_lang):
|
183 |
im = cv2.imread(img)
|
184 |
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
for bound in bounds:
|
186 |
if bound[2]>=0.3:
|
187 |
p0, p1, p2, p3 = bound[0]
|
|
|
182 |
def blur_im(img,bounds,target_lang,trans_lang):
|
183 |
im = cv2.imread(img)
|
184 |
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
185 |
+
im_h = im.shape[0]
|
186 |
+
im_w = im.shape[1]
|
187 |
+
if im_w > im_h:
|
188 |
+
rato=im_h/im_w
|
189 |
+
im = cv2.resize(im, (1000,(int((1000)*float(rato)))))
|
190 |
+
elif im_w < im_h:
|
191 |
+
rato=im_w/im_h
|
192 |
+
im = cv2.resize(im, (int((1000)*float(rato)),1000)
|
193 |
+
elif im_w == im_h:
|
194 |
+
im = cv2.resize(im,(1000,1000))
|
195 |
for bound in bounds:
|
196 |
if bound[2]>=0.3:
|
197 |
p0, p1, p2, p3 = bound[0]
|