Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,22 +24,10 @@ def detect_faces(img, size, neighbours, scale):
|
|
| 24 |
|
| 25 |
midX = int(x+w/2)
|
| 26 |
midY = int(y+h/2)
|
| 27 |
-
box = {
|
| 28 |
-
"position": {
|
| 29 |
-
"middle": [midX, midY],
|
| 30 |
-
"width": float(w),
|
| 31 |
-
"height": float(h)
|
| 32 |
-
},
|
| 33 |
-
"domain" : "pixel",
|
| 34 |
-
"class_id" : 0
|
| 35 |
-
}
|
| 36 |
box_data.append(box)
|
| 37 |
|
| 38 |
-
predictions = {"predictions": {
|
| 39 |
-
"box_data": box_data,
|
| 40 |
-
"class_labels": class_labels
|
| 41 |
-
}
|
| 42 |
-
}
|
| 43 |
|
| 44 |
re_im =cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 45 |
return re_im
|
|
@@ -55,5 +43,4 @@ description = """Face Detection with Haar Cascades using OpenCV"""
|
|
| 55 |
|
| 56 |
|
| 57 |
Iface = gr.Interface(fn=detect_faces,inputs=[image, size_slider, neighbour_slider, scale_slider],outputs=out_im,title="Haar Cascade Object Detection",).launch()
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 24 |
|
| 25 |
midX = int(x+w/2)
|
| 26 |
midY = int(y+h/2)
|
| 27 |
+
box = {"position": {"middle": [midX, midY],"width": float(w),"height": float(h)},"domain" : "pixel","class_id" : 0}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
box_data.append(box)
|
| 29 |
|
| 30 |
+
predictions = {"predictions": {"box_data": box_data,"class_labels": class_labels } }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
re_im =cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 33 |
return re_im
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
Iface = gr.Interface(fn=detect_faces,inputs=[image, size_slider, neighbour_slider, scale_slider],outputs=out_im,title="Haar Cascade Object Detection",).launch()
|
| 46 |
+
|
|
|