ravinder2024 commited on
Commit
897e20a
·
verified ·
1 Parent(s): 6c75ef2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -33
app.py CHANGED
@@ -172,46 +172,46 @@ elif upload_choice == "Upload Video":
172
  video_source = cv2.VideoCapture(tfile.name)
173
  video_feed(video_source)
174
 
175
- # Display recent SQLite records
176
- # st.markdown("### Recent Records")
177
- # conn = sqlite3.connect(DB_NAME)
178
- # cursor = conn.cursor()
179
- # cursor.execute("SELECT name, emotion, timestamp FROM face_data ORDER BY timestamp DESC LIMIT 5")
180
- # records = cursor.fetchall()
181
- # conn.close()
182
 
183
- # for record in records:
184
- # col1, col2, col3 = st.columns(3)
185
- # col1.write(f"**Name**: {record[0]}")
186
- # col2.write(f"**Emotion**: {record[1]}")
187
- # col3.write(f"**Timestamp**: {record[2]}")
188
 
189
  # import sqlite3
190
 
191
- def get_recent_records():
192
- conn = sqlite3.connect(DB_NAME)
193
- cursor = conn.cursor()
194
- cursor.execute("SELECT name, emotion, timestamp FROM face_data ORDER BY timestamp DESC LIMIT 5")
195
- records = cursor.fetchall()
196
- conn.close()
197
- return records
198
-
199
- def update_attendance(name, emotion, timestamp):
200
- conn = sqlite3.connect(DB_NAME)
201
- cursor = conn.cursor()
202
- cursor.execute("INSERT INTO face_data (name, emotion, timestamp) VALUES (?, ?, ?)", (name, emotion, timestamp))
203
- conn.commit()
204
- conn.close()
205
 
206
  # Example usage:
207
  # Insert a new attendance record (this will update the list)
208
- update_attendance("John Doe", "Happy", "2024-12-26 10:00:00")
209
 
210
- # Get the updated recent records
211
- records = get_recent_records()
212
 
213
- # Display the updated records
214
- st.markdown("### Recent Records")
215
- for record in records:
216
- st.markdown(f"Name: {record[0]}, Emotion: {record[1]}, Timestamp: {record[2]}")
217
 
 
172
  video_source = cv2.VideoCapture(tfile.name)
173
  video_feed(video_source)
174
 
175
+ Display recent SQLite records
176
+ st.markdown("### Recent Records")
177
+ conn = sqlite3.connect(DB_NAME)
178
+ cursor = conn.cursor()
179
+ cursor.execute("SELECT name, emotion, timestamp FROM face_data ORDER BY timestamp DESC LIMIT 5")
180
+ records = cursor.fetchall()
181
+ conn.close()
182
 
183
+ for record in records:
184
+ col1, col2, col3 = st.columns(3)
185
+ col1.write(f"**Name**: {record[0]}")
186
+ col2.write(f"**Emotion**: {record[1]}")
187
+ col3.write(f"**Timestamp**: {record[2]}")
188
 
189
  # import sqlite3
190
 
191
+ # def get_recent_records():
192
+ # conn = sqlite3.connect(DB_NAME)
193
+ # cursor = conn.cursor()
194
+ # cursor.execute("SELECT name, emotion, timestamp FROM face_data ORDER BY timestamp DESC LIMIT 5")
195
+ # records = cursor.fetchall()
196
+ # conn.close()
197
+ # return records
198
+
199
+ # def update_attendance(name, emotion, timestamp):
200
+ # conn = sqlite3.connect(DB_NAME)
201
+ # cursor = conn.cursor()
202
+ # cursor.execute("INSERT INTO face_data (name, emotion, timestamp) VALUES (?, ?, ?)", (name, emotion, timestamp))
203
+ # conn.commit()
204
+ # conn.close()
205
 
206
  # Example usage:
207
  # Insert a new attendance record (this will update the list)
208
+ # update_attendance("John Doe", "Happy", "2024-12-26 10:00:00")
209
 
210
+ # # Get the updated recent records
211
+ # records = get_recent_records()
212
 
213
+ # # Display the updated records
214
+ # st.markdown("### Recent Records")
215
+ # for record in records:
216
+ # st.markdown(f"Name: {record[0]}, Emotion: {record[1]}, Timestamp: {record[2]}")
217