Update app.py
Browse files
app.py
CHANGED
|
@@ -238,9 +238,19 @@ def _get_face_embedding(
|
|
| 238 |
|
| 239 |
emb = emb / np.linalg.norm(emb)
|
| 240 |
embeddings.append(emb.astype(float).tolist())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
return embeddings
|
| 243 |
-
|
| 244 |
except Exception as e:
|
| 245 |
print(f"Face embedding failed: {e}")
|
| 246 |
return None
|
|
|
|
| 238 |
|
| 239 |
emb = emb / np.linalg.norm(emb)
|
| 240 |
embeddings.append(emb.astype(float).tolist())
|
| 241 |
+
|
| 242 |
+
try:
|
| 243 |
+
del mtcnn
|
| 244 |
+
del facenet
|
| 245 |
+
except:
|
| 246 |
+
pass
|
| 247 |
+
|
| 248 |
+
if torch.cuda.is_available():
|
| 249 |
+
torch.cuda.empty_cache()
|
| 250 |
+
torch.cuda.ipc_collect()
|
| 251 |
|
| 252 |
return embeddings
|
| 253 |
+
|
| 254 |
except Exception as e:
|
| 255 |
print(f"Face embedding failed: {e}")
|
| 256 |
return None
|