RajaThor commited on
Commit
2a41cca
·
verified ·
1 Parent(s): 376c3a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -33
app.py CHANGED
@@ -353,40 +353,34 @@ def authenticate_user_ui():
353
 
354
  with c32:
355
  st.title("Insta's EYE")
356
- # Use session_state to keep track of the selected tab
357
- if "auth_tab" not in st.session_state:
358
- st.session_state.auth_tab = None # Default to None
359
-
360
- tabs = st.radio("Select Option", ["Login", "Sign-Up"], st.session_state.auth_tab)
361
- st.session_state.auth_tab = tabs
362
-
363
- if tabs == "Login":
364
- if st.session_state.auth_state["signed_in"]:
365
- st.sidebar.button("Sign Out", on_click=logout)
366
- st.title("Welcome!")
367
- main()
368
- else:
369
- email = st.text_input("Enter Email", help="Enter your email address")
370
- password = st.text_input("Enter Password", type="password", help="Enter your password")
371
-
372
- if st.button("Login"):
373
- if not email or not password:
374
- st.error("Please enter both email and password.")
 
 
 
 
375
  else:
376
- success, user = authenticate_user(email, password)
377
- if success:
378
- st.session_state.auth_state["user"] = user
379
- st.session_state.auth_state["signed_in"] = True
380
- st.success("Authentication successful! You can now manage your set of images and profiles.")
381
- main()
382
- else:
383
- st.error("Authentication failed. Please check your email and password.")
384
-
385
- elif tabs == "Sign-Up":
386
- email = st.text_input("Enter Email", help="Enter your email address")
387
- password = st.text_input("Enter Password", type="password", help="Enter your password")
388
  confirm_password = st.text_input("Confirm Password", type="password", help="Re-enter your password for confirmation")
389
-
390
  if st.button("Sign-Up"):
391
  if not email or not password or not confirm_password:
392
  st.error("Please fill all the fields.")
@@ -398,7 +392,7 @@ def authenticate_user_ui():
398
  st.success(f"User with UID: {uid} created successfully! You can now log in.")
399
  else:
400
  st.error("User creation failed. Please try again.")
401
-
402
  # Log out user
403
  def logout():
404
  st.session_state.auth_state["user"] = None
 
353
 
354
  with c32:
355
  st.title("Insta's EYE")
356
+ st.sidebar.title("Options")
357
+
358
+ if st.session_state.auth_state["signed_in"]:
359
+ st.sidebar.button("Sign Out", on_click=logout)
360
+ st.title("Welcome!")
361
+ main()
362
+ else:
363
+ option = st.sidebar.radio("Select Option", ["Login", "Sign-Up"])
364
+
365
+ email = st.text_input("Enter Email", help="Enter your email address")
366
+ password = st.text_input("Enter Password", type="password", help="Enter your password")
367
+
368
+ if option == "Login":
369
+ if st.button("Login"):
370
+ if not email or not password:
371
+ st.error("Please enter both email and password.")
372
+ else:
373
+ success, user = authenticate_user(email, password)
374
+ if success:
375
+ st.session_state.auth_state["user"] = user
376
+ st.session_state.auth_state["signed_in"] = True
377
+ st.success("Authentication successful! You can now manage your set of images and profiles.")
378
+ main()
379
  else:
380
+ st.error("Authentication failed. Please check your email and password.")
381
+
382
+ elif option == "Sign-Up":
 
 
 
 
 
 
 
 
 
383
  confirm_password = st.text_input("Confirm Password", type="password", help="Re-enter your password for confirmation")
 
384
  if st.button("Sign-Up"):
385
  if not email or not password or not confirm_password:
386
  st.error("Please fill all the fields.")
 
392
  st.success(f"User with UID: {uid} created successfully! You can now log in.")
393
  else:
394
  st.error("User creation failed. Please try again.")
395
+
396
  # Log out user
397
  def logout():
398
  st.session_state.auth_state["user"] = None