Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -200,11 +200,11 @@ ocr_lang=[
|
|
200 |
|
201 |
|
202 |
def blur_im(img,bounds):
|
|
|
203 |
for bound in bounds:
|
204 |
p0, p1, p2, p3 = bound[0]
|
205 |
-
|
206 |
-
|
207 |
-
return img
|
208 |
|
209 |
def draw_boxes(image, bounds, color='blue', width=1):
|
210 |
draw = ImageDraw.Draw(image)
|
@@ -226,7 +226,9 @@ def detect(img, target_lang,target_lang2=None):
|
|
226 |
bounds = reader.readtext(img)
|
227 |
im = PIL.Image.open(img)
|
228 |
im_out=draw_boxes(im, bounds)
|
229 |
-
|
|
|
|
|
230 |
return im_out,blr_out,pd.DataFrame(bounds),pd.DataFrame(bounds).iloc[:,1:]
|
231 |
|
232 |
|
|
|
200 |
|
201 |
|
202 |
def blur_im(img,bounds):
|
203 |
+
im = cv2.imread(img)
|
204 |
for bound in bounds:
|
205 |
p0, p1, p2, p3 = bound[0]
|
206 |
+
im[p0, p2] = cv2.blur(im[p0, p2] ,(23,23))
|
207 |
+
return im
|
|
|
208 |
|
209 |
def draw_boxes(image, bounds, color='blue', width=1):
|
210 |
draw = ImageDraw.Draw(image)
|
|
|
226 |
bounds = reader.readtext(img)
|
227 |
im = PIL.Image.open(img)
|
228 |
im_out=draw_boxes(im, bounds)
|
229 |
+
#im.save('result.jpg')
|
230 |
+
|
231 |
+
blr_out=blur_im(img,bounds)
|
232 |
return im_out,blr_out,pd.DataFrame(bounds),pd.DataFrame(bounds).iloc[:,1:]
|
233 |
|
234 |
|