Spaces:
Sleeping
Sleeping
File size: 723 Bytes
6862f85 21e5681 6862f85 80d735f 6fc5261 80d735f 6fc5261 80d735f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import streamlit as st
from streamlit_cookies_manager import EncryptedCookieManager
import os
import warnings
cookies = EncryptedCookieManager(
prefix="LUL/streamlit-cookies-manager/",
password=os.environ.get("COOKIES_PASSWORD", "uDnda87,kGFhGks"),
)
warnings.filterwarnings("ignore")
import uuid
from datetime import datetime, timedelta
user_id = cookies.get('user_id') # Attempt to retrieve the user ID cookie
if user_id is not None:
st.write(f"Your user id is {user_id}") # Display the user ID
else:
user_id = str(uuid.uuid4()) # Generate a random user ID
cookies['user_id'] = user_id # Set the cookie
st.write(f"Welcome! Your user id is {user_id}") # Display the newly generated user ID
|