gursi26 commited on
Commit
20a80f7
1 Parent(s): 2e1ca7b

test on hf works locally

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -1,17 +1,15 @@
1
  import streamlit as st
2
  import uuid
3
- import os
4
 
5
- # File to store the UUID
6
- uuid_file = "uuid.txt"
 
 
 
 
 
 
 
7
 
8
- # Check if the UUID is already saved, otherwise generate and save it
9
- if os.path.exists(uuid_file):
10
- with open(uuid_file, "r") as file:
11
- saved_uuid = file.read().strip()
12
- else:
13
- saved_uuid = str(uuid.uuid4())
14
- with open(uuid_file, "w") as file:
15
- file.write(saved_uuid)
16
-
17
- st.text_input("Your Textbox", value=saved_uuid)
 
1
  import streamlit as st
2
  import uuid
 
3
 
4
+ def get_user_id():
5
+ if "user_id" not in st.session_state:
6
+ query_params = st.query_params
7
+ user_id = query_params.get("user_id", None)
8
+ if not user_id:
9
+ user_id = str(uuid.uuid4())
10
+ st.query_params["user_id"] = user_id
11
+ st.session_state.user_id = user_id
12
+ return st.session_state.user_id
13
 
14
+ user_id = get_user_id()
15
+ st.write(f"Your unique ID is: {user_id}")