Spaces:
Runtime error
Runtime error
Commit
•
97cd054
1
Parent(s):
0851882
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def draw_boxes(img, bounds, color='yellow', width=2):
|
|
19 |
draw = ImageDraw.Draw(img)
|
20 |
for bound in bounds:
|
21 |
p0, p1, p2, p3 = bound[0]
|
22 |
-
|
23 |
#for masking the image
|
24 |
x0, y0 = p0[0][1]
|
25 |
x1, y1 = p1[0][1]
|
@@ -32,11 +32,11 @@ def draw_boxes(img, bounds, color='yellow', width=2):
|
|
32 |
mask = np.zeros(img.shape[:2], dtype="uint8")
|
33 |
cv2.line(mask, (x_mid0, y_mid0), (x_mid1, y_mi1), 255, thickness)
|
34 |
masked = cv2.bitwise_and(img, img, mask=mask)
|
|
|
35 |
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
return masked
|
40 |
|
41 |
def inference(img, lang):
|
42 |
if lang == "english":
|
|
|
19 |
draw = ImageDraw.Draw(img)
|
20 |
for bound in bounds:
|
21 |
p0, p1, p2, p3 = bound[0]
|
22 |
+
"""
|
23 |
#for masking the image
|
24 |
x0, y0 = p0[0][1]
|
25 |
x1, y1 = p1[0][1]
|
|
|
32 |
mask = np.zeros(img.shape[:2], dtype="uint8")
|
33 |
cv2.line(mask, (x_mid0, y_mid0), (x_mid1, y_mi1), 255, thickness)
|
34 |
masked = cv2.bitwise_and(img, img, mask=mask)
|
35 |
+
"""
|
36 |
|
37 |
|
38 |
+
draw.line([*p0, *p1, *p2, *p3, *p0], fill=color, width=width)
|
39 |
+
return img
|
|
|
40 |
|
41 |
def inference(img, lang):
|
42 |
if lang == "english":
|