VeuReu commited on
Commit
c6c8404
·
verified ·
1 Parent(s): d6331c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
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