Spaces:
Runtime error
Runtime error
sarwansingh
commited on
Commit
•
1152c49
1
Parent(s):
ee45314
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,18 @@ encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|
|
31 |
# camera to take photo of user in question
|
32 |
file_name = st.camera_input("Take a picture") #st.file_uploader("Upload image ")
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
if file_name is not None:
|
35 |
col1, col2 = st.columns(2)
|
36 |
|
@@ -66,6 +78,9 @@ if file_name is not None:
|
|
66 |
cv2.rectangle(image_copy, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
67 |
cv2.rectangle(image_copy, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
68 |
cv2.putText(image_copy, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
|
|
|
|
|
|
69 |
|
70 |
st.image(image_copy, use_column_width=True, output_format="PNG")
|
71 |
else:
|
|
|
31 |
# camera to take photo of user in question
|
32 |
file_name = st.camera_input("Take a picture") #st.file_uploader("Upload image ")
|
33 |
|
34 |
+
# Function to update Aadhaar data
|
35 |
+
def update_data():
|
36 |
+
url = "https://attendanceviaface.000webhostapp.com"
|
37 |
+
url1 = "/update.php"
|
38 |
+
data = {'name': 'GaRiMa', 'aadhaar': '998877'}
|
39 |
+
response = requests.post(url + url1, data=data)
|
40 |
+
|
41 |
+
if response.status_code == 200:
|
42 |
+
st.success("Data updated on: " + url)
|
43 |
+
else:
|
44 |
+
st.warning("Data not updated")
|
45 |
+
|
46 |
if file_name is not None:
|
47 |
col1, col2 = st.columns(2)
|
48 |
|
|
|
78 |
cv2.rectangle(image_copy, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
79 |
cv2.rectangle(image_copy, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
80 |
cv2.putText(image_copy, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
81 |
+
|
82 |
+
# update the database
|
83 |
+
update_data()
|
84 |
|
85 |
st.image(image_copy, use_column_width=True, output_format="PNG")
|
86 |
else:
|