Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,12 @@ def load_images():
|
|
| 14 |
images_data = json.load(file)
|
| 15 |
return images_data
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
# Custom CSS to style the buttons
|
|
@@ -70,15 +76,30 @@ def main_page(furniture_data):
|
|
| 70 |
if st.button('Show Filtered Images'):
|
| 71 |
# Assuming images_data is loaded from your JSON file
|
| 72 |
images_data = load_images() # Make sure this function is defined and loads your images data
|
| 73 |
-
|
| 74 |
-
filtered_images = filter_images(images_data, selected_options, selected_category)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
if filtered_images:
|
| 77 |
-
for
|
| 78 |
-
st.image('./images/'+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
else:
|
| 80 |
st.write("Not Trending")
|
| 81 |
-
|
| 82 |
|
| 83 |
# Main app logic
|
| 84 |
furniture_data = load_furniture_data()
|
|
|
|
| 14 |
images_data = json.load(file)
|
| 15 |
return images_data
|
| 16 |
|
| 17 |
+
def load_videos():
|
| 18 |
+
with open('./config/videos.json', 'r') as file:
|
| 19 |
+
videos_data = json.load(file)
|
| 20 |
+
return videos_data
|
| 21 |
+
|
| 22 |
+
|
| 23 |
|
| 24 |
|
| 25 |
# Custom CSS to style the buttons
|
|
|
|
| 76 |
if st.button('Show Filtered Images'):
|
| 77 |
# Assuming images_data is loaded from your JSON file
|
| 78 |
images_data = load_images() # Make sure this function is defined and loads your images data
|
| 79 |
+
videos_data = load_videos()
|
| 80 |
+
#filtered_images = filter_images(images_data, selected_options, selected_category)
|
| 81 |
+
filtered_images = ['arhaus_video_5_frame_268.png',
|
| 82 |
+
'arhaus_video_5_frame_237.png',
|
| 83 |
+
'arhaus_video_5_frame_269.png',
|
| 84 |
+
'arhaus_video_5_frame_275.png',
|
| 85 |
+
'arhaus_video_5_frame_276.png',
|
| 86 |
+
'arhaus_video_5_frame_236.png',
|
| 87 |
+
'arhaus_video_5_frame_272.png']
|
| 88 |
|
| 89 |
if filtered_images:
|
| 90 |
+
for image_name in filtered_images:
|
| 91 |
+
st.image('./images/'+image_name, width=300) # Adjust width as needed
|
| 92 |
+
|
| 93 |
+
source_video = images_data[image_name].get("source_video")
|
| 94 |
+
if source_video and source_video in videos_data:
|
| 95 |
+
with st.expander(f"Show Metadata for {image_name}"):
|
| 96 |
+
video_metadata = videos_data[source_video]
|
| 97 |
+
# Convert the metadata dictionary to a list of lists for st.table
|
| 98 |
+
metadata_for_table = [[key, value] for key, value in video_metadata.items()]
|
| 99 |
+
st.table(metadata_for_table)
|
| 100 |
else:
|
| 101 |
st.write("Not Trending")
|
| 102 |
+
|
| 103 |
|
| 104 |
# Main app logic
|
| 105 |
furniture_data = load_furniture_data()
|