Spaces:
Sleeping
Sleeping
so far
Browse files
app.py
CHANGED
@@ -33,6 +33,18 @@ with st.form("login"):
|
|
33 |
submitted = st.form_submit_button("Login")
|
34 |
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
if submitted:
|
38 |
if not password == os.environ.get("app_password"):
|
@@ -42,19 +54,20 @@ if submitted:
|
|
42 |
st.success("Welcome, " + username)
|
43 |
st.write("You are now logged in")
|
44 |
|
45 |
-
with st.form("images"):
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
48 |
healthiness = st.slider("How healthy is this picture?", 0, 100, 50)
|
49 |
-
fat_level = st.slider("How fat
|
50 |
-
muscle_level = st.slider("How muscular
|
51 |
-
password = st.text_input("Password", type="password")
|
52 |
-
|
53 |
-
# select voter from the list
|
54 |
-
username = st.selectbox("Select voter", voters)
|
55 |
-
|
56 |
# Every form must have a submit button.
|
57 |
submitted = st.form_submit_button("Submit")
|
58 |
if submitted:
|
59 |
st.write("slideers", healthiness, fat_level, muscle_level)
|
|
|
|
|
60 |
st.write("Outside the form")
|
|
|
33 |
submitted = st.form_submit_button("Login")
|
34 |
|
35 |
|
36 |
+
def get_one_from_queue(voter: str):
|
37 |
+
# get an image for the voter or return False if no image is left
|
38 |
+
|
39 |
+
df = pd.read_csv("data.csv")
|
40 |
+
|
41 |
+
# select all the rows where the voters votes is not None
|
42 |
+
df = df[df[voter].notnull()]
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
|
49 |
if submitted:
|
50 |
if not password == os.environ.get("app_password"):
|
|
|
54 |
st.success("Welcome, " + username)
|
55 |
st.write("You are now logged in")
|
56 |
|
|
|
57 |
|
58 |
+
with st.form("images"):
|
59 |
+
queue = get_one_from_queue(username)
|
60 |
+
if not queue:
|
61 |
+
st.write("You have voted for all the images")
|
62 |
+
st.stop()
|
63 |
+
st.image(queue["image"])
|
64 |
healthiness = st.slider("How healthy is this picture?", 0, 100, 50)
|
65 |
+
fat_level = st.slider("How fat is this picture?", 0, 100, 50)
|
66 |
+
muscle_level = st.slider("How muscular is this picture?", 0, 100, 50)
|
|
|
|
|
|
|
|
|
|
|
67 |
# Every form must have a submit button.
|
68 |
submitted = st.form_submit_button("Submit")
|
69 |
if submitted:
|
70 |
st.write("slideers", healthiness, fat_level, muscle_level)
|
71 |
+
# push the data to the database
|
72 |
+
|
73 |
st.write("Outside the form")
|