Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -52,13 +52,12 @@ async def detect_faces(file: UploadFile = File(...)):
|
|
52 |
center_x = (x1 + x2) // 2
|
53 |
face_width_pixels = x2 - x1
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
position = "Center"
|
62 |
|
63 |
# Calculate distance
|
64 |
estimated_distance = (
|
|
|
52 |
center_x = (x1 + x2) // 2
|
53 |
face_width_pixels = x2 - x1
|
54 |
|
55 |
+
if object_center < frame_center - 100:
|
56 |
+
position = "Left"
|
57 |
+
elif object_center > frame_center + 100:
|
58 |
+
position = "Right"
|
59 |
+
else:
|
60 |
+
position = "Center"
|
|
|
61 |
|
62 |
# Calculate distance
|
63 |
estimated_distance = (
|