Reacher commited on
Commit
a6779e7
·
1 Parent(s): 402491c
Files changed (1) hide show
  1. app.py +15 -13
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
- cls = TargetMapper[results.boxes.cls[0]]
18
- #print(cls)
19
- cv2.rectangle(
20
- image,
21
- (int(det[0]), int(det[1])),
22
- (int(det[2]), int(det[3])),
23
- color=(0, 0, 255),
24
- thickness=2,
25
- lineType=cv2.LINE_AA
26
- )
27
- cv2.putText(image, cls, (int(det[0]), int(det[1])-10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36,255,12), 2)
 
 
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(share=True)
 
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()