Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -193,53 +193,22 @@ def recognize_face():
|
|
193 |
st.info("Camera is not active. Start the camera to take a picture.")
|
194 |
|
195 |
# --- View Attendance Records ---
|
196 |
-
# def view_attendance_records():
|
197 |
-
# st.subheader("Attendance Records")
|
198 |
-
# cursor.execute("SELECT * FROM attendance ORDER BY date DESC, time DESC")
|
199 |
-
# records = cursor.fetchall()
|
200 |
-
|
201 |
-
# if records:
|
202 |
-
# df = pd.DataFrame(records, columns=["ID", "Name", "Roll No", "Date", "Time", "Status", "Emotion"])
|
203 |
-
# st.table(df)
|
204 |
-
# else:
|
205 |
-
# st.info("No attendance records available.")
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
import io
|
210 |
-
import pandas as pd
|
211 |
-
import streamlit as st
|
212 |
-
|
213 |
def view_attendance_records():
|
214 |
-
# Styled Heading
|
215 |
st.subheader("Attendance Records")
|
216 |
-
st.markdown("<h3 style='text-align: center;'>Download Attendance Records</h3>", unsafe_allow_html=True)
|
217 |
-
|
218 |
cursor.execute("SELECT * FROM attendance ORDER BY date DESC, time DESC")
|
219 |
records = cursor.fetchall()
|
220 |
|
221 |
if records:
|
222 |
df = pd.DataFrame(records, columns=["ID", "Name", "Roll No", "Date", "Time", "Status", "Emotion"])
|
223 |
st.table(df)
|
224 |
-
|
225 |
-
# Convert DataFrame to Excel
|
226 |
-
towrite = io.BytesIO()
|
227 |
-
with pd.ExcelWriter(towrite, engine='xlsxwriter') as writer:
|
228 |
-
df.to_excel(writer, index=False, sheet_name='Attendance')
|
229 |
-
towrite.seek(0)
|
230 |
-
|
231 |
-
# Add a download button with the custom heading
|
232 |
-
st.download_button(
|
233 |
-
label="Download Attendance Records",
|
234 |
-
data=towrite,
|
235 |
-
file_name="attendance_records.xlsx",
|
236 |
-
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
237 |
-
)
|
238 |
else:
|
239 |
st.info("No attendance records available.")
|
240 |
|
241 |
|
242 |
|
|
|
|
|
|
|
243 |
# --- Main Logic ---
|
244 |
if __name__ == "__main__":
|
245 |
st.title("EMOTION-MARK-AI (FACIAL SENTIMENT ANALYSIZED ATTENDANCE TRACKER)")
|
|
|
193 |
st.info("Camera is not active. Start the camera to take a picture.")
|
194 |
|
195 |
# --- View Attendance Records ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
def view_attendance_records():
|
|
|
197 |
st.subheader("Attendance Records")
|
|
|
|
|
198 |
cursor.execute("SELECT * FROM attendance ORDER BY date DESC, time DESC")
|
199 |
records = cursor.fetchall()
|
200 |
|
201 |
if records:
|
202 |
df = pd.DataFrame(records, columns=["ID", "Name", "Roll No", "Date", "Time", "Status", "Emotion"])
|
203 |
st.table(df)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
else:
|
205 |
st.info("No attendance records available.")
|
206 |
|
207 |
|
208 |
|
209 |
+
|
210 |
+
|
211 |
+
|
212 |
# --- Main Logic ---
|
213 |
if __name__ == "__main__":
|
214 |
st.title("EMOTION-MARK-AI (FACIAL SENTIMENT ANALYSIZED ATTENDANCE TRACKER)")
|