pushpinder06 commited on
Commit
868ec2c
·
verified ·
1 Parent(s): fd2531b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -82,9 +82,23 @@ with app_tab:
82
  else:
83
  st.write("Similarity Scores:", prediction_scores)
84
  matched_score = prediction_scores[match_idx].item()
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  if matched_score >= 0.6:
87
  matched_name = os.path.basename(image_paths[match_idx]).split('.')[0]
 
88
  st.success(f"✅ Welcome: {matched_name}")
89
 
90
  # Send attendance via POST
 
82
  else:
83
  st.write("Similarity Scores:", prediction_scores)
84
  matched_score = prediction_scores[match_idx].item()
85
+ image=image_pil
86
+ def detect_faces(image):
87
+ # Convert image to grayscale
88
+ gray_image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
89
+
90
+ # Detect faces
91
+ faces = face_cascade.detectMultiScale(gray_image, scaleFactor=1.3, minNeighbors=5, minSize=(30, 30))
92
+
93
+ # Draw rectangles around faces
94
+ for (x, y, w, h) in faces:
95
+ cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)
96
+
97
+ return image,
98
 
99
  if matched_score >= 0.6:
100
  matched_name = os.path.basename(image_paths[match_idx]).split('.')[0]
101
+
102
  st.success(f"✅ Welcome: {matched_name}")
103
 
104
  # Send attendance via POST