Spaces:
Runtime error
Runtime error
DerrylNessie
commited on
Commit
•
f450985
1
Parent(s):
d289e37
Update app.py
Browse files
app.py
CHANGED
@@ -25,12 +25,13 @@ def midpoint(x1, y1, x2, y2):
|
|
25 |
|
26 |
def draw_mask(img, bounds):
|
27 |
mask = np.zeros(img.shape[:2], dtype="uint8")
|
28 |
-
for
|
|
|
29 |
|
30 |
-
x0, y0 =
|
31 |
-
x1, y1 =
|
32 |
-
x2, y2 =
|
33 |
-
x3, y3 =
|
34 |
|
35 |
x_mid0, y_mid0 = midpoint(x1, y1, x2, y2)
|
36 |
x_mid1, y_mi1 = midpoint(x0, y0, x3, y3)
|
@@ -59,7 +60,7 @@ def inference(img, lang):
|
|
59 |
bounds = reader.readtext(img.name)
|
60 |
im = PIL.Image.open(img.name)
|
61 |
|
62 |
-
img_array =
|
63 |
|
64 |
#mask = PIL.Image.open(img.name)
|
65 |
#mask = Image.new("L", im.size, 0)
|
|
|
25 |
|
26 |
def draw_mask(img, bounds):
|
27 |
mask = np.zeros(img.shape[:2], dtype="uint8")
|
28 |
+
for bound in bounds:
|
29 |
+
box0, box1, box2, box3 = bound[0]
|
30 |
|
31 |
+
x0, y0 = box0
|
32 |
+
x1, y1 = box1
|
33 |
+
x2, y2 = box2
|
34 |
+
x3, y3 = box3
|
35 |
|
36 |
x_mid0, y_mid0 = midpoint(x1, y1, x2, y2)
|
37 |
x_mid1, y_mi1 = midpoint(x0, y0, x3, y3)
|
|
|
60 |
bounds = reader.readtext(img.name)
|
61 |
im = PIL.Image.open(img.name)
|
62 |
|
63 |
+
img_array = asarray(im)
|
64 |
|
65 |
#mask = PIL.Image.open(img.name)
|
66 |
#mask = Image.new("L", im.size, 0)
|