Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -201,9 +201,10 @@ ocr_lang=[
|
|
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[
|
207 |
return im
|
208 |
|
209 |
def draw_boxes(image, bounds, color='blue', width=1):
|
@@ -221,7 +222,7 @@ def detect(img, target_lang,target_lang2=None):
|
|
221 |
else:
|
222 |
lang=[f"{lang_id[target_lang]}"]
|
223 |
pass
|
224 |
-
global bounds
|
225 |
reader = easyocr.Reader(lang)
|
226 |
bounds = reader.readtext(img)
|
227 |
im = PIL.Image.open(img)
|
|
|
201 |
|
202 |
def blur_im(img,bounds):
|
203 |
im = cv2.imread(img)
|
204 |
+
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
205 |
for bound in bounds:
|
206 |
p0, p1, p2, p3 = bound[0]
|
207 |
+
im[p1, p3] = cv2.blur(im[p1, p3] ,(23,23))
|
208 |
return im
|
209 |
|
210 |
def draw_boxes(image, bounds, color='blue', width=1):
|
|
|
222 |
else:
|
223 |
lang=[f"{lang_id[target_lang]}"]
|
224 |
pass
|
225 |
+
#global bounds
|
226 |
reader = easyocr.Reader(lang)
|
227 |
bounds = reader.readtext(img)
|
228 |
im = PIL.Image.open(img)
|