Spaces:
No application file
No application file
Commit History
-
Delete app.py
Verified signature73f8577 -
Add employee_images folder with Git LFS
23ec865 -
Add employee_images folder with Git LFS
18e4ab3 -
Add employee_images folder with Git LFS
fb1bbe2 -
Update app.py
Verified signature937f111 -
Update app.py
Verified signaturee1a0b9b -
Update app.py
Verified signatureimport os # Import the os module import torch from facenet_pytorch import InceptionResnetV1, MTCNN from PIL import Image from torchvision import transforms from sklearn.metrics.pairwise import cosine_similarity import gradio as gr # Load pre-trained FaceNet model facenet_model = InceptionResnetV1(pretrained='vggface2').eval() # Load MTCNN for face detection and alignment mtcnn = MTCNN(keep_all=True, device='cuda' if torch.cuda.is_available() else 'cpu') # Preprocessing function for FaceNet with face alignment def preprocess_image_facenet(img): img = Image.fromarray(img).convert('RGB') img_cropped = mtcnn(img) if img_cropped is not None: img_cropped = img_cropped[0] # Take the first face detected transform = transforms.Compose([ transforms.Resize((160, 160)), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ]) img_tensor = transform(img_cropped).unsquee…ff2d7a9 -
Create requirements.txt
Verified signature837ab40 -
Create ap.py
Verified signaturebbbc9b0 -
initial commit
Verified signature2ef363c