Spaces:
Runtime error
Runtime error
Commit
·
704a96a
1
Parent(s):
7c2b215
app update
Browse files
app.py
CHANGED
|
@@ -48,6 +48,8 @@ def str_intercept(img_path):
|
|
| 48 |
|
| 49 |
# 人脸录入
|
| 50 |
def face_entry(img_path, name_text):
|
|
|
|
|
|
|
| 51 |
|
| 52 |
point_index, slash_index = str_intercept(img_path)
|
| 53 |
img_renamePath = f"{img_path[:slash_index+1]}{name_text}{img_path[point_index:]}"
|
|
@@ -64,6 +66,9 @@ def set_example_image(example: list):
|
|
| 64 |
|
| 65 |
|
| 66 |
def face_recognition_(img_srcPath, img_tagPath, img_personName):
|
|
|
|
|
|
|
|
|
|
| 67 |
image_of_person = face_recognition.load_image_file(img_srcPath)
|
| 68 |
person_face_encoding = face_recognition.face_encodings(image_of_person)[0]
|
| 69 |
|
|
|
|
| 48 |
|
| 49 |
# 人脸录入
|
| 50 |
def face_entry(img_path, name_text):
|
| 51 |
+
if img_path == "" or name_text == "" or img_path is None or name_text is None:
|
| 52 |
+
return None, None, None
|
| 53 |
|
| 54 |
point_index, slash_index = str_intercept(img_path)
|
| 55 |
img_renamePath = f"{img_path[:slash_index+1]}{name_text}{img_path[point_index:]}"
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
def face_recognition_(img_srcPath, img_tagPath, img_personName):
|
| 69 |
+
if img_tagPath == "" or img_tagPath is None:
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
image_of_person = face_recognition.load_image_file(img_srcPath)
|
| 73 |
person_face_encoding = face_recognition.face_encodings(image_of_person)[0]
|
| 74 |
|