Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,25 +38,34 @@ def filter_images(images_data, selected_options, category):
|
|
| 38 |
# Function to display the main page
|
| 39 |
def main_page(furniture_data):
|
| 40 |
st.title("Social Media - What's Trending")
|
| 41 |
-
|
| 42 |
-
category = st.selectbox('Select Category', ['Apparel', 'Furnitures', 'Beauty'])
|
| 43 |
-
brands = ['Arhaus', 'Crate&Barrel', 'Williams Sonoma', 'Pottery Barn', 'West Elm', 'Z Gallerie']
|
| 44 |
-
brand = st.selectbox('Select Brand', brands)
|
| 45 |
-
|
| 46 |
# Dictionary to store selected options for each attribute
|
| 47 |
selected_options = {}
|
| 48 |
|
| 49 |
# Dropdown for selecting furniture category
|
| 50 |
categories = list(furniture_data['Furniture'].keys())
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Load attributes based on the selected category
|
| 54 |
attributes = furniture_data['Furniture'][selected_category]['attributes']
|
|
|
|
| 55 |
|
| 56 |
# Create a multi-select widget for each attribute with a unique key
|
| 57 |
-
for attribute, options in attributes.items():
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 60 |
|
| 61 |
if st.button('Show Filtered Images'):
|
| 62 |
# Assuming images_data is loaded from your JSON file
|
|
|
|
| 38 |
# Function to display the main page
|
| 39 |
def main_page(furniture_data):
|
| 40 |
st.title("Social Media - What's Trending")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
# Dictionary to store selected options for each attribute
|
| 42 |
selected_options = {}
|
| 43 |
|
| 44 |
# Dropdown for selecting furniture category
|
| 45 |
categories = list(furniture_data['Furniture'].keys())
|
| 46 |
+
brands = ['Arhaus', 'Crate&Barrel', 'Williams Sonoma', 'Pottery Barn', 'West Elm', 'Z Gallerie']
|
| 47 |
+
|
| 48 |
+
col1, col2, col3 = st.beta_columns(3)
|
| 49 |
+
|
| 50 |
+
with col1:
|
| 51 |
+
category = st.selectbox('Select Category', ['Apparel', 'Furnitures', 'Beauty'])
|
| 52 |
+
|
| 53 |
+
with col2:
|
| 54 |
+
brand = st.selectbox('Select Brand', brands)
|
| 55 |
+
|
| 56 |
+
with col3:
|
| 57 |
+
selected_category = st.selectbox('Select Category', categories)
|
| 58 |
+
|
| 59 |
|
| 60 |
# Load attributes based on the selected category
|
| 61 |
attributes = furniture_data['Furniture'][selected_category]['attributes']
|
| 62 |
+
columns = st.beta_columns(len(attributes))
|
| 63 |
|
| 64 |
# Create a multi-select widget for each attribute with a unique key
|
| 65 |
+
for i, (attribute, options) in enumerate(attributes.items()):
|
| 66 |
+
with columns[i]:
|
| 67 |
+
key = f"{selected_category}_{attribute}" # Unique key combining category and attribute
|
| 68 |
+
selected_options[attribute] = st.multiselect(f'Choose {attribute}', options, key=key)
|
| 69 |
|
| 70 |
if st.button('Show Filtered Images'):
|
| 71 |
# Assuming images_data is loaded from your JSON file
|