ravinder2024 commited on
Commit
f567f9a
·
verified ·
1 Parent(s): cbb51cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -25
app.py CHANGED
@@ -48,31 +48,11 @@ encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
48
 
49
  ####### Section 3 ###################
50
  # Take picture using the camera
51
- #img_file_buffer = st.camera_input("Take Your picture")
52
-
53
- # File uploader to upload an image
54
- uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
55
-
56
- #if uploaded_file is not None:
57
- # Open the image file and convert it into a format that OpenCV can process
58
- #image = Image.open(uploaded_file)
59
-
60
- # Detect faces in the image
61
- # result_image = detect_faces(image)
62
-
63
- # Convert the result image from OpenCV format back to PIL format for display
64
- #result_image_pil = Image.fromarray(result_image)
65
-
66
- # Display the image with detected faces
67
- #st.image(result_image_pil, caption="Detected Faces", use_column_width=True)
68
-
69
-
70
- #else:
71
- #print("no img")
72
 
73
  # recognise the face in the uploaded image
74
- if uploaded_file is not None:
75
- test_image = Image.open(uploaded_file)
76
  image = np.asarray(test_image)
77
  image = image.copy()
78
 
@@ -136,5 +116,4 @@ if uploaded_file is not None:
136
  st.image(image , use_column_width=True, output_format="PNG")
137
 
138
  if(faceMatchedflag == 0) :
139
- st.warning("No faces detected in the image.")
140
-
 
48
 
49
  ####### Section 3 ###################
50
  # Take picture using the camera
51
+ img_file_buffer = st.camera_input("Take Your picture")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  # recognise the face in the uploaded image
54
+ if img_file_buffer is not None:
55
+ test_image = Image.open(img_file_buffer)
56
  image = np.asarray(test_image)
57
  image = image.copy()
58
 
 
116
  st.image(image , use_column_width=True, output_format="PNG")
117
 
118
  if(faceMatchedflag == 0) :
119
+ st.warning("No faces detected in the image.")