Spaces:
Sleeping
Sleeping
test on hf works locally
Browse files
app.py
CHANGED
@@ -1,17 +1,15 @@
|
|
1 |
import streamlit as st
|
2 |
import uuid
|
3 |
-
import os
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
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}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|