Spaces:
Runtime error
Runtime error
ASL app
Browse files
app.py
CHANGED
@@ -13,18 +13,20 @@ def show_preds_image(image_path):
|
|
13 |
image = cv2.imread(image_path)
|
14 |
outputs = model.predict(source=image_path)
|
15 |
results = outputs[0].cpu().numpy()
|
16 |
-
for i, det in enumerate(results.boxes.xyxy):
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
cv2.
|
|
|
|
|
28 |
|
29 |
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
30 |
|
@@ -42,4 +44,4 @@ gr.Interface(
|
|
42 |
title="Arab Sign Language Detection app",
|
43 |
examples=path,
|
44 |
cache_examples=False,
|
45 |
-
).launch(
|
|
|
13 |
image = cv2.imread(image_path)
|
14 |
outputs = model.predict(source=image_path)
|
15 |
results = outputs[0].cpu().numpy()
|
16 |
+
#for i, det in enumerate(results.boxes.xyxy):
|
17 |
+
cls = TargetMapper[results.boxes.cls[0]]
|
18 |
+
det = results.boxes.xyxy[0]
|
19 |
+
#print(det)
|
20 |
+
#print(cls)
|
21 |
+
cv2.rectangle(
|
22 |
+
image,
|
23 |
+
(int(det[0]), int(det[1])),
|
24 |
+
(int(det[2]), int(det[3])),
|
25 |
+
color=(0, 0, 255),
|
26 |
+
thickness=2,
|
27 |
+
lineType=cv2.LINE_AA
|
28 |
+
)
|
29 |
+
cv2.putText(image, cls, (int(det[0]), int(det[1])-10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36,255,12), 2)
|
30 |
|
31 |
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
32 |
|
|
|
44 |
title="Arab Sign Language Detection app",
|
45 |
examples=path,
|
46 |
cache_examples=False,
|
47 |
+
).launch()
|