Spaces:
Sleeping
Sleeping
see
Browse files
app.py
CHANGED
@@ -26,23 +26,35 @@ voters = [
|
|
26 |
"volunteer-5",
|
27 |
]
|
28 |
|
29 |
-
#
|
30 |
-
st.write("Environment variables")
|
31 |
-
# read environment variable named app_password
|
32 |
-
st.write(os.environ.get("app_password"))
|
33 |
-
|
34 |
with st.form("images"):
|
|
|
|
|
|
|
35 |
|
36 |
-
st.write("Inside the form")
|
37 |
-
slider_val = st.slider("How fat")
|
38 |
|
39 |
-
password = st.text_input("Password", type="password")
|
40 |
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
st.write("Outside the form")
|
|
|
26 |
"volunteer-5",
|
27 |
]
|
28 |
|
29 |
+
# login page
|
|
|
|
|
|
|
|
|
30 |
with st.form("images"):
|
31 |
+
username = st.text_input("Username")
|
32 |
+
password = st.text_input("Password", type="password")
|
33 |
+
submitted = st.form_submit_button("Login")
|
34 |
|
|
|
|
|
35 |
|
|
|
36 |
|
37 |
+
if submitted:
|
38 |
+
if not password == os.environ.get("app_password"):
|
39 |
+
st.error("The password you entered is incorrect")
|
40 |
+
st.stop()
|
41 |
+
else:
|
42 |
+
st.success("Welcome, " + username)
|
43 |
+
st.write("You are now logged in")
|
44 |
+
|
45 |
+
with st.form("images"):
|
46 |
+
|
47 |
+
st.write("Inside the form")
|
48 |
+
healthiness = st.slider("How healthy is this picture?", 0, 100, 50)
|
49 |
+
fat_level = st.slider("How fat are you", 0, 100, 50)
|
50 |
+
muscle_level = st.slider("How muscular are you?", 0, 100, 50)
|
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")
|