Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -175,27 +175,27 @@ if picture:
|
|
| 175 |
st.text("انتقل الى مكان جيد الإضاءة")
|
| 176 |
else:
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
if largest_face is not None:
|
| 200 |
# Calculate the expanded dimensions
|
| 201 |
expansion_factor = 1.5
|
|
|
|
| 175 |
st.text("انتقل الى مكان جيد الإضاءة")
|
| 176 |
else:
|
| 177 |
|
| 178 |
+
# Initialize the face detector
|
| 179 |
+
faceDetector = dlib.get_frontal_face_detector()
|
| 180 |
+
|
| 181 |
+
# Assuming 'frm' is your input image
|
| 182 |
+
faces = faceDetector(frm, 0)
|
| 183 |
+
|
| 184 |
+
# Check if there are any faces detected
|
| 185 |
+
if len(faces) > 0:
|
| 186 |
+
largest_face = None
|
| 187 |
+
max_area = 0
|
| 188 |
+
|
| 189 |
+
# Find the largest face
|
| 190 |
+
for face in faces:
|
| 191 |
+
w = face.right() - face.left()
|
| 192 |
+
h = face.bottom() - face.top()
|
| 193 |
+
area = w * h
|
| 194 |
+
if area > max_area:
|
| 195 |
+
max_area = area
|
| 196 |
+
largest_face = face
|
| 197 |
+
|
| 198 |
+
# If a largest face is detected
|
| 199 |
if largest_face is not None:
|
| 200 |
# Calculate the expanded dimensions
|
| 201 |
expansion_factor = 1.5
|