RajaThor commited on
Commit
9e3862d
·
verified ·
1 Parent(s): b7759d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -3
app.py CHANGED
@@ -211,6 +211,15 @@ def delete_person(name):
211
  except Exception as e:
212
  return f"Failed to delete person: {str(e)}"
213
 
 
 
 
 
 
 
 
 
 
214
  # Send feedback to Firebase
215
  def send_feedback(feedback_data):
216
  try:
@@ -385,6 +394,17 @@ def display_history(user_email):
385
  st.error(f"Failed to retrieve history: {str(e)}")
386
  #End of history section
387
 
 
 
 
 
 
 
 
 
 
 
 
388
  def tour_guide_ui():
389
  st.title("🗺️ Tour Guide")
390
  st.markdown("This tour will guide you through the application.")
@@ -506,8 +526,8 @@ def display_tour_steps(steps):
506
  # Update the main function to include the feedback option
507
  def main():
508
  st.sidebar.title("Options")
509
- option = st.sidebar.radio("Select Option", ["Add Person", "Recognize Face", "Delete Person", "Recognize Face (Optimal)", "Tour Guide", "Feedback", "Messenger", "History"])
510
-
511
  if option == "Add Person":
512
  add_person_ui()
513
  elif option == "Recognize Face":
@@ -524,7 +544,9 @@ def main():
524
  messenger_ui()
525
  elif option == "History":
526
  display_history(st.session_state.auth_state["user"].email)
527
-
 
 
528
  # Run the tour guide
529
  if __name__ == "__main__":
530
  authenticate_user_ui()
 
211
  except Exception as e:
212
  return f"Failed to delete person: {str(e)}"
213
 
214
+ # Delete user from Firebase Authentication
215
+ def delete_user(email):
216
+ try:
217
+ user = auth.get_user_by_email(email)
218
+ auth.delete_user(user.uid)
219
+ return "User deleted successfully!"
220
+ except Exception as e:
221
+ return f"Failed to delete user: {str(e)}"
222
+
223
  # Send feedback to Firebase
224
  def send_feedback(feedback_data):
225
  try:
 
394
  st.error(f"Failed to retrieve history: {str(e)}")
395
  #End of history section
396
 
397
+ # Streamlit interface for Deleting user
398
+ def delete_user_ui():
399
+ st.title("Delete User")
400
+ email = st.text_input("Enter User's Email", help="Enter the email of the user to delete")
401
+ if st.button("Delete User"):
402
+ if not email:
403
+ st.error("Please enter a user's email.")
404
+ else:
405
+ result = delete_user(email)
406
+ st.success(result)
407
+
408
  def tour_guide_ui():
409
  st.title("🗺️ Tour Guide")
410
  st.markdown("This tour will guide you through the application.")
 
526
  # Update the main function to include the feedback option
527
  def main():
528
  st.sidebar.title("Options")
529
+ option = st.sidebar.radio("Select Option", ["Add Person", "Recognize Face", "Delete Person", "Recognize Face (Optimal)", "Tour Guide", "Feedback", "Messenger", "History", "Delete User"])
530
+
531
  if option == "Add Person":
532
  add_person_ui()
533
  elif option == "Recognize Face":
 
544
  messenger_ui()
545
  elif option == "History":
546
  display_history(st.session_state.auth_state["user"].email)
547
+ elif option == "Delete User":
548
+ delete_user_ui()
549
+
550
  # Run the tour guide
551
  if __name__ == "__main__":
552
  authenticate_user_ui()