sarwansingh commited on
Commit
e113da5
·
verified ·
1 Parent(s): 9493109

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -33,7 +33,8 @@ img_file_buffer = st.camera_input("Take a picture")
33
  if img_file_buffer is not None:
34
  test_image = Image.open(img_file_buffer)
35
  image = np.asarray(test_image)
36
-
 
37
  imgS = cv2.resize(image, (0, 0), None, 0.25, 0.25)
38
  imgS = cv2.cvtColor(imgS, cv2.COLOR_BGR2RGB)
39
  facesCurFrame = face_recognition.face_locations(imgS)
@@ -52,12 +53,12 @@ if img_file_buffer is not None:
52
  # show the name on image to user
53
  y1, x2, y2, x1 = faceLoc
54
  y1, x2, y2, x1 = y1 * 4, x2 * 4, y2 * 4, x1 * 4
55
- cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
56
- cv2.rectangle(image, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
57
- cv2.putText(image, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
58
 
59
  # display_image_with_overlay(image, name)
60
- st.image(image, use_column_width=True, output_format="PNG")
61
  else :
62
  st.warning("No faces detected in the image.")
63
 
 
33
  if img_file_buffer is not None:
34
  test_image = Image.open(img_file_buffer)
35
  image = np.asarray(test_image)
36
+ image1 = cv2.imread(test_image)
37
+
38
  imgS = cv2.resize(image, (0, 0), None, 0.25, 0.25)
39
  imgS = cv2.cvtColor(imgS, cv2.COLOR_BGR2RGB)
40
  facesCurFrame = face_recognition.face_locations(imgS)
 
53
  # show the name on image to user
54
  y1, x2, y2, x1 = faceLoc
55
  y1, x2, y2, x1 = y1 * 4, x2 * 4, y2 * 4, x1 * 4
56
+ cv2.rectangle(image1, (x1, y1), (x2, y2), (0, 255, 0), 2)
57
+ cv2.rectangle(image1, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
58
+ cv2.putText(image1, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
59
 
60
  # display_image_with_overlay(image, name)
61
+ st.image(image1, use_column_width=True, output_format="PNG")
62
  else :
63
  st.warning("No faces detected in the image.")
64