Spaces:
Sleeping
Sleeping
add uuid
Browse files
app.py
CHANGED
|
@@ -4,6 +4,10 @@ import pandas as pd
|
|
| 4 |
import huggingface_hub as hfh
|
| 5 |
import requests
|
| 6 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
os.makedirs("labels", exist_ok=True)
|
| 9 |
|
|
@@ -133,7 +137,8 @@ if submitted or st.session_state['loggedin'] == 'true':
|
|
| 133 |
healthiness = st.slider("How healthy is this picture?", 0, 100, 50)
|
| 134 |
fat_level = st.slider("How fat is this picture?", 0, 100, 50)
|
| 135 |
muscle_level = st.slider("How muscular is this picture?", 0, 100, 50)
|
| 136 |
-
#
|
|
|
|
| 137 |
submitted_second = st.form_submit_button("Submit")
|
| 138 |
|
| 139 |
if submitted_second:
|
|
@@ -145,7 +150,7 @@ if submitted or st.session_state['loggedin'] == 'true':
|
|
| 145 |
fat_level=fat_level,
|
| 146 |
muscle_level=muscle_level
|
| 147 |
)
|
| 148 |
-
st.write("Vote submitted")
|
| 149 |
# push the data to the database
|
| 150 |
|
| 151 |
st.write("Outside the form")
|
|
|
|
| 4 |
import huggingface_hub as hfh
|
| 5 |
import requests
|
| 6 |
import time
|
| 7 |
+
import uuid
|
| 8 |
+
|
| 9 |
+
def get_uuid():
|
| 10 |
+
return str(uuid.uuid4())[:6]
|
| 11 |
|
| 12 |
os.makedirs("labels", exist_ok=True)
|
| 13 |
|
|
|
|
| 137 |
healthiness = st.slider("How healthy is this picture?", 0, 100, 50)
|
| 138 |
fat_level = st.slider("How fat is this picture?", 0, 100, 50)
|
| 139 |
muscle_level = st.slider("How muscular is this picture?", 0, 100, 50)
|
| 140 |
+
# generate 6 digit uuid for this form and print it in case the user wants to undo the vote
|
| 141 |
+
uuid_num = get_uuid()
|
| 142 |
submitted_second = st.form_submit_button("Submit")
|
| 143 |
|
| 144 |
if submitted_second:
|
|
|
|
| 150 |
fat_level=fat_level,
|
| 151 |
muscle_level=muscle_level
|
| 152 |
)
|
| 153 |
+
st.write(f"Vote submitted uuid: {uuid_num} (in case you want to undo the vote)")
|
| 154 |
# push the data to the database
|
| 155 |
|
| 156 |
st.write("Outside the form")
|