RajaThor commited on
Commit
3b3b006
·
verified ·
1 Parent(s): 6d9602f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -8
app.py CHANGED
@@ -281,6 +281,17 @@ def delete_person_ui():
281
  if not name:
282
  st.error("Please enter a name.")
283
  else:
 
 
 
 
 
 
 
 
 
 
 
284
  result = delete_person(name)
285
  st.success(result)
286
 
@@ -485,8 +496,24 @@ steps = [
485
  "content": "Here you can select different options such as adding a person, recognizing a face, deleting a person, or recognizing a face with optimal identification.",
486
  },
487
  {
488
- "title": "Main Interface",
489
- "content": "This is where the main functionality of the application is displayed.",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  },
491
  {
492
  "title": "Upload Image",
@@ -516,16 +543,16 @@ def display_tour_steps(steps):
516
  # Update the main function to include the feedback option
517
  def main():
518
  st.sidebar.title("Options")
519
- option = st.sidebar.radio("Select Option", ["Add Person", "Recognize Face", "Delete Person", "Recognize Face (Optimal)", "Tour Guide", "Feedback", "Messaging", "History", "Delete User"])
520
 
521
- if option == "Add Person":
522
- add_person_ui()
523
- elif option == "Recognize Face":
524
  recognize_face_ui()
525
- elif option == "Delete Person":
526
- delete_person_ui()
527
  elif option == "Recognize Face (Optimal)":
528
  recognize_face_optimal_ui()
 
 
 
 
529
  elif option == "Tour Guide":
530
  tour_guide_ui()
531
  elif option == "Feedback":
 
281
  if not name:
282
  st.error("Please enter a name.")
283
  else:
284
+ # Check if the person exists in the database
285
+ if name not in ref.get().keys():
286
+ st.error("Person not found in the database.")
287
+ return
288
+
289
+ # Check if the person was added by the currently signed-in user
290
+ person_data = ref.child(name).get()
291
+ if person_data["added_by"] != st.session_state.auth_state["user"].email:
292
+ st.error("You can only delete the person added by you.")
293
+ return
294
+
295
  result = delete_person(name)
296
  st.success(result)
297
 
 
496
  "content": "Here you can select different options such as adding a person, recognizing a face, deleting a person, or recognizing a face with optimal identification.",
497
  },
498
  {
499
+ "title": "Recognize face",
500
+ "content": "This function will return you Id's for your provided face.",
501
+ },
502
+ {
503
+ "title": "Recognize face(optimal)",
504
+ "content": "This function will return you Id's of provided face with more accuracy",
505
+ },
506
+ {
507
+ "title": "Add person",
508
+ "content": "Here you can add yourself or someone else too",
509
+ },
510
+ {
511
+ "title": "Delete person",
512
+ "content": "Here you can delete the person by entering their name",
513
+ },
514
+ {
515
+ "title": "History",
516
+ "content": "Here you can track history of your activities",
517
  },
518
  {
519
  "title": "Upload Image",
 
543
  # Update the main function to include the feedback option
544
  def main():
545
  st.sidebar.title("Options")
546
+ option = st.sidebar.radio("Select Option", ["Recognize Face", "Add Person", "Recognize Face (Optimal)", "Delete Person", "Tour Guide", "Feedback", "Messaging", "History", "Delete User"])
547
 
548
+ if option == "Recognize Face":
 
 
549
  recognize_face_ui()
 
 
550
  elif option == "Recognize Face (Optimal)":
551
  recognize_face_optimal_ui()
552
+ elif option == "Add Person":
553
+ add_person_ui()
554
+ elif option == "Delete Person":
555
+ delete_person_ui()
556
  elif option == "Tour Guide":
557
  tour_guide_ui()
558
  elif option == "Feedback":