KRISH09bha commited on
Commit
66ba1b9
·
verified ·
1 Parent(s): 91958b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
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
- # Determine position (Left, Center, Right) with corrected logic
56
- if center_x <= frame_width // 3:
57
- position = "Left"
58
- elif center_x >= 2 * frame_width // 3:
59
- position = "Right"
60
- else:
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 = (