Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,14 +6,14 @@ from PIL import Image
|
|
6 |
from PIL import ImageDraw
|
7 |
|
8 |
|
9 |
-
def draw_boxes(image, bounds, color='
|
10 |
draw = ImageDraw.Draw(image)
|
11 |
for bound in bounds:
|
12 |
p0, p1, p2, p3 = bound[0]
|
13 |
draw.line([*p0, *p1, *p2, *p3, *p0], fill=color, width=width)
|
14 |
return image
|
15 |
|
16 |
-
def detect(img, lang='en'):
|
17 |
reader = easyocr.Reader(lang)
|
18 |
bounds = reader.readtext(img.name)
|
19 |
im = PIL.Image.open(img.name)
|
|
|
6 |
from PIL import ImageDraw
|
7 |
|
8 |
|
9 |
+
def draw_boxes(image, bounds, color='blue', width=2):
|
10 |
draw = ImageDraw.Draw(image)
|
11 |
for bound in bounds:
|
12 |
p0, p1, p2, p3 = bound[0]
|
13 |
draw.line([*p0, *p1, *p2, *p3, *p0], fill=color, width=width)
|
14 |
return image
|
15 |
|
16 |
+
def detect(img, lang=['en']):
|
17 |
reader = easyocr.Reader(lang)
|
18 |
bounds = reader.readtext(img.name)
|
19 |
im = PIL.Image.open(img.name)
|