import os if not os.path.exists("data/"): os.makedirs("data/") # now curl -L -o data/human-segmentation-dataset.zip https://www.kaggle.com/api/v1/datasets/download/trainingdatapro/human-segmentation-dataset os.system("curl -L -o data/human-segmentation-dataset.zip https://www.kaggle.com/api/v1/datasets/download/trainingdatapro/human-segmentation-dataset") os.system("unzip data/human-segmentation-dataset.zip -d data/") os.system("rm data/human-segmentation-dataset.zip") import streamlit as st import pandas as pd import numpy as np voters = [ "osman", "eren", "robin", "mira", "bilal", "volunteer-1", "volunteer-2", "volunteer-3", "volunteer-4", "volunteer-5", ] # login page with st.form("login"): username = st.selectbox("Select voter", voters) password = st.text_input("Password (get password from contact@osbm.dev)", type="password") submitted = st.form_submit_button("Login") def get_one_from_queue(voter: str): # get an image for the voter or return False if no image is left df = pd.read_csv("data.csv") # select all the rows where the voters votes is not None df = df[df[voter].notnull()] if submitted: if not password == os.environ.get("app_password"): st.error("The password you entered is incorrect") st.stop() else: st.success("Welcome, " + username) st.write("You are now logged in") with st.form("images"): queue = get_one_from_queue(username) if not queue: st.write("You have voted for all the images") st.stop() st.image(queue["image"]) healthiness = st.slider("How healthy is this picture?", 0, 100, 50) fat_level = st.slider("How fat is this picture?", 0, 100, 50) muscle_level = st.slider("How muscular is this picture?", 0, 100, 50) # Every form must have a submit button. submitted = st.form_submit_button("Submit") if submitted: st.write("slideers", healthiness, fat_level, muscle_level) # push the data to the database st.write("Outside the form")