# Full App Code import streamlit as st import pandas as pd # Define function for dramatic header def dramatic_header(text, emoji): st.markdown(f"## {emoji} {text} {emoji}") # Streamlit App Function def glasses_art_app(): st.title("Glasses Art Workshop 🕶️") # Dramatic Situation 1: The Creation Challenge dramatic_header("The Creation Challenge", "🖼️") st.markdown("**Artisans**, welcome to the ultimate glasses design competition!") glass_types = ["Round", "Square", "Cat Eye", "Aviator"] colors = ["Red", "Blue", "Green", "Black", "White"] materials = ["Plastic", "Metal", "Wood", "Composite"] chosen_glass = st.selectbox("Choose your glass type:", glass_types) chosen_color = st.color_picker("Pick a color for your glasses:", "#000000") chosen_material = st.selectbox("Choose the material:", materials) st.markdown(f"🕶️ You have chosen **{chosen_glass}**, color **{chosen_color}**, and material **{chosen_material}**!") if "designs" not in st.session_state: st.session_state.designs = [] design = {"glass_type": chosen_glass, "color": chosen_color, "material": chosen_material} if st.button("Submit Design"): st.session_state.designs.append(design) st.success("Design submitted!") # Dramatic Situation 2: The Evaluation dramatic_header("The Evaluation", "🔄") st.markdown("**Enthusiasts**, it's time to review the latest designs!") if st.session_state.designs: designs_df = pd.DataFrame(st.session_state.designs) st.dataframe(designs_df) ratings = {} for i, design in designs_df.iterrows(): rating = st.slider(f"Rate design {i+1}: {design['glass_type']} ({design['color']}, {design['material']})", 1, 5, 3) ratings[i] = rating if st.button("Submit Ratings"): st.session_state.ratings = ratings st.success("Ratings submitted!") # Dramatic Situation 3: The Exhibition dramatic_header("The Exhibition", "🎉") st.markdown("Check out the top-rated designs in our virtual gallery!") if st.session_state.get("ratings"): rated_designs = [{"design": st.session_state.designs[i], "rating": rating} for i, rating in st.session_state.ratings.items()] top_rated_designs = sorted(rated_designs, key=lambda x: x["rating"], reverse=True) st.markdown("### 🏆 Top Designs 🏆") for item in top_rated_designs: design = item["design"] rating = item["rating"] st.markdown(f"**{design['glass_type']}** ({design['color']}, {design['material']}) – Rating: {rating}/5") # Call the app function glasses_art_app()