| import streamlit as st | |
| from streamlit_tags import st_tags | |
| def store_user(): | |
| st.session_state["users"].append(st.session_state["user"]) | |
| st.session_state["user"]["part_one"] = { | |
| "age": [age], | |
| "school": [school], | |
| "work": [work], | |
| "work_other": [work_other], | |
| "img_rapport": [img_rapport], | |
| "img_other": [img_other], | |
| "img_freq": [img_freq], | |
| "img_expert": [img_expert], | |
| "ai_expert": [ai_expert], | |
| "genova_expert": [genova_expert], | |
| "genova_freq": [genova_freq], | |
| "genova_knowledge": [genova_knowledge], | |
| "genova_thoughts": [genova_thoughts] | |
| } | |
| st.title("Studio sulla City Identity") | |
| with st.form("demografica"): | |
| age = st.radio( | |
| "Età", | |
| [ | |
| "18-24", | |
| "25-34", | |
| "35-44", | |
| "45-54", | |
| "55-64", | |
| "65-74" | |
| ] | |
| ) | |
| school = st.radio( | |
| "Grado di istruzione", | |
| [ | |
| "Scuola secondaria di primo grado", | |
| "Scuola secondaria di secondo grado", | |
| "Laurea triennale", | |
| "Laurea specialistica", | |
| "Dottorato di ricerca" | |
| ] | |
| ) | |
| work = st.radio( | |
| "Mi occupo di", | |
| [ | |
| "Architettura", | |
| "Design", | |
| "Informatica", | |
| "Altro" | |
| ] | |
| ) | |
| work_other = st.text_input("Se altro, indica cosa...(premere INVIO per confermare)") | |
| img_rapport = st.radio( | |
| "Il mio rapporto con le immagini è:", | |
| [ | |
| "Professionale", | |
| "Hobbistico", | |
| "Casuale", | |
| "Altro" | |
| ] | |
| ) | |
| img_other = st.text_input("Se altro, indica quale...(premere INVIO per confermare)") | |
| img_freq = st.radio( | |
| "Quanto spesso ho a che fare con le immagini", | |
| [ | |
| "Raramente", | |
| "Qualche volta", | |
| "Spesso", | |
| "Costantemente" | |
| ] | |
| ) | |
| img_expert = st.radio( | |
| "Sono un esperto di immagini", | |
| [ | |
| "1 - Per nulla", | |
| "2", | |
| "3", | |
| "4", | |
| "5 - Pienamente" | |
| ], | |
| horizontal=True | |
| ) | |
| ai_expert = st.radio( | |
| "Utilizzo strumenti IA per la generazione di immagini (es. Dall-E, Midjourney, Firefly, ecc.)", | |
| [ | |
| "Mai", | |
| "Raramente", | |
| "Qualche volta", | |
| "Spesso", | |
| "Sempre" | |
| ] | |
| ) | |
| genova_expert = st.radio( | |
| "La mia familiarità con la città di Genova è:", | |
| [ | |
| "1 - Per nulla familiare", | |
| "2", | |
| "3", | |
| "4", | |
| "5 - Pienamente familiare" | |
| ], | |
| horizontal=True | |
| ) | |
| genova_freq = st.radio( | |
| "Frequento la città di Genova", | |
| [ | |
| "Mai", | |
| "Raramente", | |
| "Qualche volta", | |
| "Spesso", | |
| "Sempre" | |
| ] | |
| ) | |
| genova_knowledge = st.radio( | |
| "Conosco le attrazioni ed i paesaggi della città di Genova", | |
| [ | |
| "1 - Per nulla", | |
| "2", | |
| "3", | |
| "4", | |
| "5 - Del tutto" | |
| ], | |
| horizontal=True | |
| ) | |
| genova_thoughts = st_tags( | |
| label="Quando penso all'architettura di Genova mi immagino (premere INVIO per confermare):", | |
| text="Premere invio per aggiungere un nuovo elemento", | |
| value=[], | |
| maxtags=-1) | |
| submit = st.form_submit_button("Salva", on_click=store_user) | |
| if submit: | |
| if len(genova_expert) == 0: | |
| st.warning("Per favore, compila tutte le domande obbligatorie") | |
| else: | |
| st.success("Salvataggio completato") | |
| st.page_link("pages/annotation.py", label="Continua") | |