Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -32,47 +32,6 @@ 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 |
-
|
36 |
-
geolocation_js = """
|
37 |
-
<script>
|
38 |
-
function getLocation() {
|
39 |
-
console.log("Attempting to get location...");
|
40 |
-
if (navigator.geolocation) {
|
41 |
-
console.log("Geolocation supported, getting current position...");
|
42 |
-
navigator.geolocation.getCurrentPosition(sendLocation, handleLocationError);
|
43 |
-
} else {
|
44 |
-
alert("Geolocation is not supported by this browser.");
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
function sendLocation(position) {
|
49 |
-
console.log("Location obtained successfully:", position.coords.latitude, position.coords.longitude);
|
50 |
-
Streamlit.setComponentValue({"latitude": position.coords.latitude, "longitude": position.coords.longitude});
|
51 |
-
}
|
52 |
-
|
53 |
-
function handleLocationError(error) {
|
54 |
-
console.error("Error getting location:", error.message);
|
55 |
-
}
|
56 |
-
</script>
|
57 |
-
"""
|
58 |
-
|
59 |
-
# Display the JavaScript code
|
60 |
-
st.write(geolocation_js, unsafe_allow_html=True)
|
61 |
-
|
62 |
-
# Run JavaScript code to access geolocation when button is clicked
|
63 |
-
button_clicked = st.button("Get Location")
|
64 |
-
if button_clicked:
|
65 |
-
st.write("<script>getLocation()</script>", unsafe_allow_html=True)
|
66 |
-
|
67 |
-
# Receive latitude and longitude from JavaScript
|
68 |
-
latitude_received = st.session_state.get("latitude")
|
69 |
-
longitude_received = st.session_state.get("longitude")
|
70 |
-
|
71 |
-
# Display latitude and longitude
|
72 |
-
if latitude_received is not None and longitude_received is not None:
|
73 |
-
st.write(f"Latitude: {latitude_received}, Longitude: {longitude_received}")
|
74 |
-
else:
|
75 |
-
st.write("Latitude and longitude not yet obtained.")
|
76 |
def add_attendance(names):
|
77 |
url = "https://ai-ml-project.glitch.me/adduserdata1" # Change this URL to your Glitch endpoint
|
78 |
success_count = 0
|
|
|
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
|