ohayonguy
commited on
Commit
·
94bce76
1
Parent(s):
2cd7eda
trying to fix interface
Browse files
app.py
CHANGED
|
@@ -74,7 +74,13 @@ def enhance_face(img, face_helper, has_aligned, num_flow_steps, only_center_face
|
|
| 74 |
# TODO: even with eye_dist_threshold, it will still introduce wrong detections and restorations.
|
| 75 |
# align and warp each face
|
| 76 |
face_helper.align_warp_face()
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
# face restoration
|
| 79 |
for i, cropped_face in tqdm(enumerate(face_helper.cropped_faces)):
|
| 80 |
# prepare data
|
|
|
|
| 74 |
# TODO: even with eye_dist_threshold, it will still introduce wrong detections and restorations.
|
| 75 |
# align and warp each face
|
| 76 |
face_helper.align_warp_face()
|
| 77 |
+
if len(face_helper.cropped_faces) == 0:
|
| 78 |
+
raise gr.Error("Could not identify any face in the image.")
|
| 79 |
+
if len(face_helper.cropped_faces) > 1:
|
| 80 |
+
gr.Info(f"Identified {len(face_helper.cropped_faces)} faces in the image. The algorithm will enhance the quality of each face.")
|
| 81 |
+
else:
|
| 82 |
+
gr.Info(f"Identified one face in the image.")
|
| 83 |
+
|
| 84 |
# face restoration
|
| 85 |
for i, cropped_face in tqdm(enumerate(face_helper.cropped_faces)):
|
| 86 |
# prepare data
|