[tlthr764] commited on
Commit
3d0eee3
·
1 Parent(s): 1c07459
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -7,6 +7,20 @@ import torch
7
  import numpy as np
8
  import gradio as gr
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  def detect_faces(input_img):
11
  # download model
12
  model_path = hf_hub_download(
 
7
  import numpy as np
8
  import gradio as gr
9
 
10
+ # 함수 정의: 사각형 그리고 정확도 표시
11
+ def draw_rect_with_conf(image, detections):
12
+ for detection in detections:
13
+ # 탐지된 객체의 경계 상자 좌표 (NumPy 배열)와 신뢰도 점수
14
+ box, _, conf, _, _ = detection
15
+ x1, y1, x2, y2 = box.astype(int)
16
+
17
+ # 사각형 그리기
18
+ cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
19
+
20
+ # 신뢰도 표시
21
+ cv2.putText(image, f'Accuracy: {conf:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
22
+ return image
23
+
24
  def detect_faces(input_img):
25
  # download model
26
  model_path = hf_hub_download(