Wajahat698 commited on
Commit
bbf4602
·
verified ·
1 Parent(s): 006ee8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -21
app.py CHANGED
@@ -706,25 +706,24 @@ def side():
706
 
707
  # Image paths and labels (pre-resized images in your folder)
708
  st.sidebar.header("TrustVault®")
 
709
  st.markdown("""
710
- <style>
711
- .scrollable-container {
712
- max-height: 300px;
713
- overflow-y: auto;
714
- border: 1px solid gray;
715
- padding: 10px;
716
- border-radius: 5px;
717
- background-color: #f9f9f9;
718
- }
719
- </style>
720
- """, unsafe_allow_html=True)
721
 
722
  # Container for Saved Documents
723
  with st.container():
724
  st.subheader("Saved Documents")
725
  st.write("Save documents like your brand tonality, key phrases, or segments here.")
726
-
727
- # Scrollable container with gray border
728
  st.markdown('<div class="scrollable-container">', unsafe_allow_html=True)
729
 
730
  docs = fetch_documents(st.session_state["wix_user_id"])
@@ -756,7 +755,11 @@ def side():
756
 
757
  if submit_upload:
758
  if uploaded_files:
759
- md_contents = [convert_file_to_md(file) for file in uploaded_files if convert_file_to_md(file)]
 
 
 
 
760
  if md_contents:
761
  merged_md_content = merge_markdown_contents(md_contents)
762
  public_url = upload_to_firebase(st.session_state["wix_user_id"], merged_md_content)
@@ -795,7 +798,7 @@ def side():
795
  st.write(f"Brand: {result_data.get('brand', 'N/A')}")
796
  st.write(f"Bucket: {result_data.get('bucket', 'N/A')}")
797
  st.write(f"Message: {result_data.get('message', '')}")
798
- # Add delete button for each TrustBuilder
799
  if st.button(f"Delete TrustBuilder {result_id[:8]}", key=f"del_tb_{result_id}"):
800
  delete_trustbuilder(st.session_state["wix_user_id"], result_id)
801
  else:
@@ -807,9 +810,10 @@ def side():
807
  bucket_labels = ["Stability", "Development", "Relationship", "Benefit", "Vision", "Competence"]
808
  cols = st.columns(len(trust_buckets))
809
  for idx, (bucket, label) in enumerate(zip(trust_buckets, bucket_labels)):
810
- if cols[idx].button(f"{bucket}", key=f"bucket_{label}"):
811
- st.write(f"Selected Trust Bucket: {label}")
812
- st.session_state["selected_bucket"] = label
 
813
 
814
  # Save TrustBuilders Section
815
  st.subheader("Save TrustBuilders®")
@@ -820,8 +824,9 @@ def side():
820
  st.write("Allocate to")
821
  cols_allocate = st.columns(len(trust_buckets))
822
  for idx, (bucket, label) in enumerate(zip(trust_buckets, bucket_labels)):
823
- if cols_allocate[idx].button(f"{bucket}", key=f"allocate_{label}"):
824
- save_content(st.session_state["wix_user_id"], brand, trust_builder_text, trust_bucket=label)
 
825
 
826
  if st.button("Let AI allocate"):
827
  allocated_bucket = ai_allocate_trust_bucket(trust_builder_text)
@@ -830,8 +835,30 @@ def side():
830
  st.success(f"AI allocated the Trust Bucket: {allocated_bucket} and saved your TrustBuilder.")
831
  else:
832
  st.error("AI could not allocate the Trust Bucket.")
833
-
834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
835
  side()
836
  # Load knowledge base
837
 
 
706
 
707
  # Image paths and labels (pre-resized images in your folder)
708
  st.sidebar.header("TrustVault®")
709
+ # CSS for scrollable container with gray border
710
  st.markdown("""
711
+ <style>
712
+ .scrollable-container {
713
+ max-height: 300px;
714
+ overflow-y: auto;
715
+ border: 1px solid gray;
716
+ padding: 10px;
717
+ border-radius: 5px;
718
+ background-color: #f9f9f9;
719
+ }
720
+ </style>
721
+ """, unsafe_allow_html=True)
722
 
723
  # Container for Saved Documents
724
  with st.container():
725
  st.subheader("Saved Documents")
726
  st.write("Save documents like your brand tonality, key phrases, or segments here.")
 
 
727
  st.markdown('<div class="scrollable-container">', unsafe_allow_html=True)
728
 
729
  docs = fetch_documents(st.session_state["wix_user_id"])
 
755
 
756
  if submit_upload:
757
  if uploaded_files:
758
+ md_contents = []
759
+ for file in uploaded_files:
760
+ md_content = convert_file_to_md(file)
761
+ if md_content:
762
+ md_contents.append(md_content)
763
  if md_contents:
764
  merged_md_content = merge_markdown_contents(md_contents)
765
  public_url = upload_to_firebase(st.session_state["wix_user_id"], merged_md_content)
 
798
  st.write(f"Brand: {result_data.get('brand', 'N/A')}")
799
  st.write(f"Bucket: {result_data.get('bucket', 'N/A')}")
800
  st.write(f"Message: {result_data.get('message', '')}")
801
+ # Delete button
802
  if st.button(f"Delete TrustBuilder {result_id[:8]}", key=f"del_tb_{result_id}"):
803
  delete_trustbuilder(st.session_state["wix_user_id"], result_id)
804
  else:
 
810
  bucket_labels = ["Stability", "Development", "Relationship", "Benefit", "Vision", "Competence"]
811
  cols = st.columns(len(trust_buckets))
812
  for idx, (bucket, label) in enumerate(zip(trust_buckets, bucket_labels)):
813
+ with cols[idx]:
814
+ if st.button(f"{bucket}", key=f"bucket_{label}"):
815
+ st.write(f"Selected Trust Bucket: {label}")
816
+ st.session_state["selected_bucket"] = label
817
 
818
  # Save TrustBuilders Section
819
  st.subheader("Save TrustBuilders®")
 
824
  st.write("Allocate to")
825
  cols_allocate = st.columns(len(trust_buckets))
826
  for idx, (bucket, label) in enumerate(zip(trust_buckets, bucket_labels)):
827
+ with cols_allocate[idx]:
828
+ if st.button(f"{bucket}", key=f"allocate_{label}"):
829
+ save_content(st.session_state["wix_user_id"], brand, trust_builder_text, trust_bucket=label)
830
 
831
  if st.button("Let AI allocate"):
832
  allocated_bucket = ai_allocate_trust_bucket(trust_builder_text)
 
835
  st.success(f"AI allocated the Trust Bucket: {allocated_bucket} and saved your TrustBuilder.")
836
  else:
837
  st.error("AI could not allocate the Trust Bucket.")
 
838
 
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+
851
+
852
+
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+
861
+
862
  side()
863
  # Load knowledge base
864