thanhson28 commited on
Commit
42ad4b8
1 Parent(s): 9647917

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -47,8 +47,8 @@ ages_genders_detector = HumanAG_ONNX(
47
 
48
  def detect_objects(img, thr):
49
  # infer img
50
- print(img)
51
- img = cv2.imread(img)
52
  objs = person_detector.infer(img, threshold=thr)
53
  # logger.info(f"Number of objs: {len(objs)}")
54
 
@@ -65,6 +65,8 @@ def detect_objects(img, thr):
65
 
66
  def detect_poses(img, thr):
67
  # infer img
 
 
68
  objs = person_detector.infer(img, threshold=thr)
69
  objs = [obj for obj in objs if obj['confidence'] > 0.5]
70
  output_text = ""
@@ -102,6 +104,8 @@ def detect_poses(img, thr):
102
 
103
 
104
  def detect_ages_gender(img, thr):
 
 
105
  # infer img
106
  objs = person_detector.infer(img, threshold=thr)
107
  objs = [obj for obj in objs if obj['confidence'] > 0.5]
 
47
 
48
  def detect_objects(img, thr):
49
  # infer img
50
+ if isinstance(img, str):
51
+ img = cv2.imread(img)
52
  objs = person_detector.infer(img, threshold=thr)
53
  # logger.info(f"Number of objs: {len(objs)}")
54
 
 
65
 
66
  def detect_poses(img, thr):
67
  # infer img
68
+ if isinstance(img, str):
69
+ img = cv2.imread(img)
70
  objs = person_detector.infer(img, threshold=thr)
71
  objs = [obj for obj in objs if obj['confidence'] > 0.5]
72
  output_text = ""
 
104
 
105
 
106
  def detect_ages_gender(img, thr):
107
+ if isinstance(img, str):
108
+ img = cv2.imread(img)
109
  # infer img
110
  objs = person_detector.infer(img, threshold=thr)
111
  objs = [obj for obj in objs if obj['confidence'] > 0.5]