Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -820,23 +820,20 @@ def side():
|
|
| 820 |
st.write("Choose the Trust Bucket® by clicking on an image:")
|
| 821 |
st.markdown('<div class="image-container">', unsafe_allow_html=True)
|
| 822 |
for bucket, img_path in image_files:
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
<
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
)
|
| 838 |
-
except FileNotFoundError:
|
| 839 |
-
st.warning(f"Image not found: {img_path}")
|
| 840 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 841 |
|
| 842 |
# Save TrustBuilders Section
|
|
@@ -848,25 +845,23 @@ def side():
|
|
| 848 |
st.write("Choose the Trust Bucket® by clicking on an image to save:")
|
| 849 |
st.markdown('<div class="image-container">', unsafe_allow_html=True)
|
| 850 |
for bucket, img_path in image_files:
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
<
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
)
|
| 866 |
-
except FileNotFoundError:
|
| 867 |
-
st.warning(f"Image not found: {img_path}")
|
| 868 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 869 |
-
|
|
|
|
| 870 |
|
| 871 |
|
| 872 |
|
|
|
|
| 820 |
st.write("Choose the Trust Bucket® by clicking on an image:")
|
| 821 |
st.markdown('<div class="image-container">', unsafe_allow_html=True)
|
| 822 |
for bucket, img_path in image_files:
|
| 823 |
+
try:
|
| 824 |
+
# Display clickable image as a button
|
| 825 |
+
if st.button(label="", key=f"filter_{bucket}", help=f"Filter by {bucket}"):
|
| 826 |
+
search_query = bucket
|
| 827 |
+
st.markdown(
|
| 828 |
+
f"""
|
| 829 |
+
<div class="image-wrapper">
|
| 830 |
+
<img src="{img_path}" alt="{bucket}" title="{bucket}">
|
| 831 |
+
</div>
|
| 832 |
+
""",
|
| 833 |
+
unsafe_allow_html=True,
|
| 834 |
+
)
|
| 835 |
+
except FileNotFoundError:
|
| 836 |
+
st.warning(f"Image not found: {img_path}")
|
|
|
|
|
|
|
|
|
|
| 837 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 838 |
|
| 839 |
# Save TrustBuilders Section
|
|
|
|
| 845 |
st.write("Choose the Trust Bucket® by clicking on an image to save:")
|
| 846 |
st.markdown('<div class="image-container">', unsafe_allow_html=True)
|
| 847 |
for bucket, img_path in image_files:
|
| 848 |
+
try:
|
| 849 |
+
# Display clickable image for saving
|
| 850 |
+
if st.button(label="", key=f"save_{bucket}", help=f"Save to {bucket}"):
|
| 851 |
+
save_trustbuilder(user_id, trust_builder_text.strip(), bucket)
|
| 852 |
+
st.markdown(
|
| 853 |
+
f"""
|
| 854 |
+
<div class="image-wrapper">
|
| 855 |
+
<img src="{img_path}" alt="{bucket}" title="{bucket}">
|
| 856 |
+
</div>
|
| 857 |
+
""",
|
| 858 |
+
unsafe_allow_html=True,
|
| 859 |
+
)
|
| 860 |
+
except FileNotFoundError:
|
| 861 |
+
st.warning(f"Image not found: {img_path}")
|
|
|
|
|
|
|
|
|
|
| 862 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 863 |
+
else:
|
| 864 |
+
st.warning("Please enter a Trust Builder text to save.")
|
| 865 |
|
| 866 |
|
| 867 |
|