Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,6 +32,44 @@ encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|
|
32 |
|
33 |
# camera to take photo of user in question
|
34 |
file_name = st.camera_input("Upload image")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
def add_attendance(names):
|
36 |
url = "https://ai-ml-project.glitch.me/adduserdata1" # Change this URL to your Glitch endpoint
|
37 |
success_count = 0
|
|
|
32 |
|
33 |
# camera to take photo of user in question
|
34 |
file_name = st.camera_input("Upload image")
|
35 |
+
|
36 |
+
|
37 |
+
geolocation_js = """
|
38 |
+
<script>
|
39 |
+
function getLocation() {
|
40 |
+
if (navigator.geolocation) {
|
41 |
+
navigator.geolocation.getCurrentPosition(sendLocation);
|
42 |
+
} else {
|
43 |
+
alert("Geolocation is not supported by this browser.");
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
function sendLocation(position) {
|
48 |
+
var latitude = position.coords.latitude;
|
49 |
+
var longitude = position.coords.longitude;
|
50 |
+
Streamlit.setComponentValue({"latitude": latitude, "longitude": longitude});
|
51 |
+
}
|
52 |
+
</script>
|
53 |
+
"""
|
54 |
+
|
55 |
+
# Display the JavaScript code
|
56 |
+
st.write(geolocation_js, unsafe_allow_html=True)
|
57 |
+
|
58 |
+
# Run JavaScript code to access geolocation when button is clicked
|
59 |
+
button_clicked = st.button("Get Location")
|
60 |
+
if button_clicked:
|
61 |
+
st.write("<script>getLocation()</script>", unsafe_allow_html=True)
|
62 |
+
|
63 |
+
# Receive latitude and longitude from JavaScript
|
64 |
+
latitude_received = st.session_state.get("latitude")
|
65 |
+
longitude_received = st.session_state.get("longitude")
|
66 |
+
|
67 |
+
# Display latitude and longitude
|
68 |
+
if latitude_received is not None and longitude_received is not None:
|
69 |
+
st.write(f"Latitude: {latitude_received}, Longitude: {longitude_received}")
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
def add_attendance(names):
|
74 |
url = "https://ai-ml-project.glitch.me/adduserdata1" # Change this URL to your Glitch endpoint
|
75 |
success_count = 0
|