Wajahat698 commited on
Commit
3a68f30
·
verified ·
1 Parent(s): 59eb780

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -39
app.py CHANGED
@@ -801,41 +801,14 @@ def side():
801
  st.write("No TrustBuilders found.")
802
  st.markdown("</div>", unsafe_allow_html=True)
803
 
804
- st.write("Choose the Trust Bucket® by clicking an image:")
805
- st.markdown('<div class="image-container">', unsafe_allow_html=True)
806
- for bucket, img_path in image_files:
807
- try:
808
- if os.path.exists(img_path):
809
- # Display clickable image as a button
810
- if st.button(label="", key=f"filter_{bucket}", help=f"Filter by {bucket}"):
811
- st.write(f"You clicked on {bucket} bucket!")
812
- st.markdown(
813
- f"""
814
- <div class="image-wrapper">
815
- <img src="{img_path}" alt="{bucket}" title="{bucket}">
816
- </div>
817
- """,
818
- unsafe_allow_html=True,
819
- )
820
- else:
821
- st.warning(f"Image not found: {img_path}")
822
- except Exception as e:
823
- st.error(f"Error loading image {img_path}: {e}")
824
- st.markdown("</div>", unsafe_allow_html=True)
825
-
826
- # Save TrustBuilders Section
827
- st.subheader("Save TrustBuilders®")
828
- brand = st.text_input("Brand/Product/Person", key="brand_input_save")
829
- trust_builder_text = st.text_area("Type/paste Trust Builder®", height=100)
830
-
831
- if trust_builder_text.strip():
832
- st.write("Choose the Trust Bucket® by clicking on an image to save:")
833
- st.markdown('<div class="image-container">', unsafe_allow_html=True)
834
- for bucket, img_path in image_files:
835
- try:
836
- # Display clickable image for saving
837
- if st.button(label="", key=f"save_{bucket}", help=f"Save to {bucket}"):
838
- save_trustbuilder(user_id, trust_builder_text.strip(), bucket)
839
  st.markdown(
840
  f"""
841
  <div class="image-wrapper">
@@ -844,11 +817,38 @@ def side():
844
  """,
845
  unsafe_allow_html=True,
846
  )
847
- except FileNotFoundError:
848
  st.warning(f"Image not found: {img_path}")
849
- st.markdown("</div>", unsafe_allow_html=True)
850
- else:
851
- st.warning("Please enter a Trust Builder text to save.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
 
853
 
854
 
 
801
  st.write("No TrustBuilders found.")
802
  st.markdown("</div>", unsafe_allow_html=True)
803
 
804
+ st.write("Choose the Trust Bucket® by clicking an image:")
805
+ st.markdown('<div class="image-container">', unsafe_allow_html=True)
806
+ for bucket, img_path in image_files:
807
+ try:
808
+ if os.path.exists(img_path):
809
+ # Display clickable image as a button
810
+ if st.button(label="", key=f"filter_{bucket}", help=f"Filter by {bucket}"):
811
+ st.write(f"You clicked on {bucket} bucket!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
812
  st.markdown(
813
  f"""
814
  <div class="image-wrapper">
 
817
  """,
818
  unsafe_allow_html=True,
819
  )
820
+ else:
821
  st.warning(f"Image not found: {img_path}")
822
+ except Exception as e:
823
+ st.error(f"Error loading image {img_path}: {e}")
824
+ st.markdown("</div>", unsafe_allow_html=True)
825
+
826
+ # Save TrustBuilders Section
827
+ st.subheader("Save TrustBuilders®")
828
+ brand = st.text_input("Brand/Product/Person", key="brand_input_save")
829
+ trust_builder_text = st.text_area("Type/paste Trust Builder®", height=100)
830
+
831
+ if trust_builder_text.strip():
832
+ st.write("Choose the Trust Bucket® by clicking on an image to save:")
833
+ st.markdown('<div class="image-container">', unsafe_allow_html=True)
834
+ for bucket, img_path in image_files:
835
+ try:
836
+ # Display clickable image for saving
837
+ if st.button(label="", key=f"save_{bucket}", help=f"Save to {bucket}"):
838
+ save_trustbuilder(user_id, trust_builder_text.strip(), bucket)
839
+ st.markdown(
840
+ f"""
841
+ <div class="image-wrapper">
842
+ <img src="{img_path}" alt="{bucket}" title="{bucket}">
843
+ </div>
844
+ """,
845
+ unsafe_allow_html=True,
846
+ )
847
+ except FileNotFoundError:
848
+ st.warning(f"Image not found: {img_path}")
849
+ st.markdown("</div>", unsafe_allow_html=True)
850
+ else:
851
+ st.warning("Please enter a Trust Builder text to save.")
852
 
853
 
854