Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -82,10 +82,6 @@ def verify(image, model, person):
|
|
82 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as temp_image:
|
83 |
temp_image.write(image.read())
|
84 |
temp_image_path = temp_image.name
|
85 |
-
|
86 |
-
image = cv2.imread(temp_image_path)
|
87 |
-
|
88 |
-
face = get_face(image)
|
89 |
|
90 |
if face is not None:
|
91 |
if model == "Siamese":
|
@@ -93,6 +89,10 @@ def verify(image, model, person):
|
|
93 |
siamese.load_state_dict(torch.load(f'siamese_{person.lower()}.pth'))
|
94 |
siamese.eval()
|
95 |
|
|
|
|
|
|
|
|
|
96 |
face = preprocess_image_siamese(face)
|
97 |
|
98 |
with torch.no_grad():
|
@@ -111,6 +111,10 @@ def verify(image, model, person):
|
|
111 |
with open(f'./pca_{person.lower()}.pkl', 'rb') as f:
|
112 |
pca = joblib.load(f)
|
113 |
|
|
|
|
|
|
|
|
|
114 |
face = preprocess_image_svm(face)
|
115 |
|
116 |
hog = extract_hog_features(face)
|
|
|
82 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as temp_image:
|
83 |
temp_image.write(image.read())
|
84 |
temp_image_path = temp_image.name
|
|
|
|
|
|
|
|
|
85 |
|
86 |
if face is not None:
|
87 |
if model == "Siamese":
|
|
|
89 |
siamese.load_state_dict(torch.load(f'siamese_{person.lower()}.pth'))
|
90 |
siamese.eval()
|
91 |
|
92 |
+
image = Image.open(temp_image_path)
|
93 |
+
|
94 |
+
face = get_face(image)
|
95 |
+
|
96 |
face = preprocess_image_siamese(face)
|
97 |
|
98 |
with torch.no_grad():
|
|
|
111 |
with open(f'./pca_{person.lower()}.pkl', 'rb') as f:
|
112 |
pca = joblib.load(f)
|
113 |
|
114 |
+
image = cv2.imread(temp_image_path)
|
115 |
+
|
116 |
+
face = get_face(image)
|
117 |
+
|
118 |
face = preprocess_image_svm(face)
|
119 |
|
120 |
hog = extract_hog_features(face)
|