Jacobmadwed commited on
Commit
087f163
·
verified ·
1 Parent(s): 0747dd5

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -3
handler.py CHANGED
@@ -145,10 +145,10 @@ class EndpointHandler:
145
  print(f"Confidences shape: {confidences.shape}, Boxes shape: {boxes.shape}")
146
 
147
  face_info_list = []
148
- for i in range(boxes.shape[0]):
149
  box = boxes[i]
150
  conf = confidences[i]
151
- if conf.shape[0] > 0 and conf[0] > 0.7: # Fixing the out-of-bounds issue
152
  x1, y1, x2, y2 = box[0] * 320, box[1] * 240, box[2] * 320, box[3] * 240
153
  face_info_list.append({"bbox": [x1, y1, x2, y2]})
154
  return face_info_list
@@ -271,4 +271,3 @@ class EndpointHandler:
271
  def apply_style(self, style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
272
  p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
273
  return p.replace("{prompt}", positive), n + " " + negative
274
-
 
145
  print(f"Confidences shape: {confidences.shape}, Boxes shape: {boxes.shape}")
146
 
147
  face_info_list = []
148
+ for i in range(len(boxes)):
149
  box = boxes[i]
150
  conf = confidences[i]
151
+ if conf[0] > 0.7: # Fixing the out-of-bounds issue
152
  x1, y1, x2, y2 = box[0] * 320, box[1] * 240, box[2] * 320, box[3] * 240
153
  face_info_list.append({"bbox": [x1, y1, x2, y2]})
154
  return face_info_list
 
271
  def apply_style(self, style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
272
  p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
273
  return p.replace("{prompt}", positive), n + " " + negative