Spaces:
Build error
Build error
Update app.py
Browse files8 unmodified lines910111213141516171819202122232425115 unmodified lines1411421431441451461478 unmodified linesimport numpy as npfrom PIL import Imagefrom facenet_pytorch import MTCNN, InceptionResnetV1# Load Google Drive API credentials from the uploaded JSON fileSERVICE_ACCOUNT_FILE = './salesforce-api-439514-d6b432a2e20e.json' # Assuming the JSON file is in the root directorySCOPES = ['https://www.googleapis.com/auth/drive']credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)drive_service = build('drive', 'v3', credentials=credentials)# Folder IDsaadhar_folder_id = '1jXklVbxTni1gnduuKgJ7zI6zVks6s0LP'cphotos_folder_id = '1JVJMtHuIHxZyxAekT6ZQFkEWePOimIlX'suspects_folder_id = '1LJE5aw_g5Jvqd5cLZ7UiJ8LyR36JkBKP'# Initialize MTCNN for face detection and InceptionResnetV1 for face recognitionmtcnn = MTCNN(image_size=160, margin=0, min_face_size=20)115 unmodified linesif not matched:upload_file(file_path, suspects_folder_id)print(f"Unmatched image uploaded: {file['name']}")print("Processing of images completed.")def main():8 unmodified lines910111213141516171819202122232425262728293031115 unmodified lines1471481491501511521538 unmodified linesimport numpy as npfrom PIL import Imagefrom facenet_pytorch import MTCNN, InceptionResnetV1import json# Load Google Drive API credentials from the uploaded JSON fileSERVICE_ACCOUNT_FILE = './.env' # Assuming the uploaded JSON file is named '.env'SCOPES = ['https://www.googleapis.com/auth/drive']# Load credentials from the JSON filewith open(SERVICE_ACCOUNT_FILE, 'r') as json_file:credentials_info = json.load(json_file)credentials = service_account.Credentials.from_service_account_info(credentials_info, scopes=SCOPES)drive_service = build('drive', 'v3', credentials=credentials)# Folder IDsaadhar_folder_id = '1Qtb5DYzSFE67Mbb5ZgDIqWUtdJaDD2F4'cphotos_folder_id = '1DGeRqRbCPcfLDdEgP0h5fyX-MF8EQ8AH'suspects_folder_id = '1N3RMhVD0OygeufLPYod6IYLtqzvlm3Jv'# Initialize MTCNN for face detection and InceptionResnetV1 for face recognitionmtcnn = MTCNN(image_size=160, margin=0, min_face_size=20)115 unmodified linesif not matched:upload_file(file_path, suspects_folder_id)print(f"Unmatched image uploaded: {file['name']}")print("Processing of images completed.")def main():
app.py+12-6