Ajay98 commited on
Commit
fd6cd9e
·
verified ·
1 Parent(s): c10e270

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -8,6 +8,21 @@ suspects_folder_id = '1N3RMhVD0OygeufLPYod6IYLtqzvlm3Jv'
8
 
9
 
10
  # Improved function to batch process images with better face comparison logic
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  def batch_process_images(aadhar_folder_id, cphotos_folder_id, suspects_folder_id):
12
  # Fetch Aadhar and CCTV files
13
  aadhar_files = list_files_in_folder(aadhar_folder_id)
 
8
 
9
 
10
  # Improved function to batch process images with better face comparison logic
11
+ def list_files_in_folder(folder_id):
12
+ print(f"Listing files in folder ID: {folder_id}")
13
+ query = f"'{folder_id}' in parents and trashed=false"
14
+ try:
15
+ results = drive_service.files().list(q=query, pageSize=1000, fields="files(id, name, mimeType, owners, parents)").execute()
16
+ files = results.get('files', [])
17
+ if not files:
18
+ print(f"No files found in folder ID: {folder_id}. Ensure that the folder has files and the service account has access.")
19
+ else:
20
+ print(f"Found {len(files)} files in folder ID: {folder_id}.")
21
+ return files
22
+ except Exception as e:
23
+ print(f"Error listing files in folder ID: {folder_id} - {e}")
24
+ return []
25
+
26
  def batch_process_images(aadhar_folder_id, cphotos_folder_id, suspects_folder_id):
27
  # Fetch Aadhar and CCTV files
28
  aadhar_files = list_files_in_folder(aadhar_folder_id)