LovnishVerma
commited on
Commit
•
eba549b
1
Parent(s):
329cfe8
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ import requests
|
|
5 |
import face_recognition
|
6 |
import os
|
7 |
import streamlit as st
|
8 |
-
import csv
|
9 |
|
10 |
# Set page title and description
|
11 |
st.set_page_config(
|
@@ -40,18 +39,6 @@ def validate_aadhaar(aadhaar):
|
|
40 |
# For simplicity, let's assume any 6-digit number is a valid Aadhaar card
|
41 |
return len(aadhaar) == 6 and aadhaar.isdigit()
|
42 |
|
43 |
-
# Function to read names and Aadhaar numbers from a CSV file
|
44 |
-
def read_csv(file_path):
|
45 |
-
data = []
|
46 |
-
with open(file_path, mode='r') as file:
|
47 |
-
reader = csv.reader(file)
|
48 |
-
for row in reader:
|
49 |
-
data.append(row)
|
50 |
-
return data
|
51 |
-
|
52 |
-
# Load names and Aadhaar numbers from CSV file
|
53 |
-
csv_data = read_csv('csv.csv') # Replace 'your_csv_file.csv' with the actual file path
|
54 |
-
|
55 |
# Take picture using the camera and input Aadhaar card details
|
56 |
img_file_buffer = st.camera_input("Take a picture")
|
57 |
aadhaar_number = st.text_input("Enter Aadhaar Number:")
|
@@ -71,6 +58,7 @@ if img_file_buffer is not None:
|
|
71 |
|
72 |
if len(encodesCurFrame) > 0:
|
73 |
for encodeFace, faceLoc in zip(encodesCurFrame, facesCurFrame):
|
|
|
74 |
matches = face_recognition.compare_faces(encodeListknown, encodeFace)
|
75 |
faceDis = face_recognition.face_distance(encodeListknown, encodeFace)
|
76 |
matchIndex = np.argmin(faceDis)
|
@@ -101,7 +89,7 @@ if img_file_buffer is not None:
|
|
101 |
# Match Aadhaar number with the list
|
102 |
aadhar_index = aadhar_numbers.index(aadhaar_number) if aadhaar_number in aadhar_numbers else None
|
103 |
if aadhar_index is not None:
|
104 |
-
st.success(f"Match found: {
|
105 |
else:
|
106 |
st.warning("Face not detected, and Aadhaar number not found in the database.")
|
107 |
else:
|
|
|
5 |
import face_recognition
|
6 |
import os
|
7 |
import streamlit as st
|
|
|
8 |
|
9 |
# Set page title and description
|
10 |
st.set_page_config(
|
|
|
39 |
# For simplicity, let's assume any 6-digit number is a valid Aadhaar card
|
40 |
return len(aadhaar) == 6 and aadhaar.isdigit()
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
# Take picture using the camera and input Aadhaar card details
|
43 |
img_file_buffer = st.camera_input("Take a picture")
|
44 |
aadhaar_number = st.text_input("Enter Aadhaar Number:")
|
|
|
58 |
|
59 |
if len(encodesCurFrame) > 0:
|
60 |
for encodeFace, faceLoc in zip(encodesCurFrame, facesCurFrame):
|
61 |
+
# Assuming that encodeListknown is defined and populated in your code
|
62 |
matches = face_recognition.compare_faces(encodeListknown, encodeFace)
|
63 |
faceDis = face_recognition.face_distance(encodeListknown, encodeFace)
|
64 |
matchIndex = np.argmin(faceDis)
|
|
|
89 |
# Match Aadhaar number with the list
|
90 |
aadhar_index = aadhar_numbers.index(aadhaar_number) if aadhaar_number in aadhar_numbers else None
|
91 |
if aadhar_index is not None:
|
92 |
+
st.success(f"Match found: {classnames[aadhar_index]}")
|
93 |
else:
|
94 |
st.warning("Face not detected, and Aadhaar number not found in the database.")
|
95 |
else:
|