Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,6 +41,7 @@ import io
|
|
| 41 |
from firebase_admin import credentials, firestore
|
| 42 |
import base64
|
| 43 |
from pdfminer.high_level import extract_text # Import for PDF text extraction
|
|
|
|
| 44 |
|
| 45 |
st.set_page_config(layout="wide")
|
| 46 |
import logging
|
|
@@ -504,6 +505,8 @@ def side():
|
|
| 504 |
with st.sidebar:
|
| 505 |
|
| 506 |
with st.sidebar.expander("TrustLogic®", expanded=False):
|
|
|
|
|
|
|
| 507 |
st.markdown(
|
| 508 |
"Our minds assess trust through Six Buckets of Trust® and determine their importance and order in a given situation. We then evaluate why we can or can’t trust someone in these Buckets. Trustifier.ai®, trained on 20 years of TrustLogic® application, helps you identify reasons why your audience can trust you in each Bucket and create trust-optimised solutions. It’s copy AI with substance."
|
| 509 |
)
|
|
@@ -538,10 +541,11 @@ def side():
|
|
| 538 |
""", unsafe_allow_html=True
|
| 539 |
)
|
| 540 |
st.markdown("For detailed descriptions, visit [Academy](https://www.trustifier.ai/account/academy)")
|
| 541 |
-
|
| 542 |
-
|
|
|
|
| 543 |
|
| 544 |
-
|
| 545 |
st.markdown(
|
| 546 |
"Our minds assess trust through Six Buckets of Trust® and determine their importance and order in a given situation. We then evaluate why we can or can’t trust someone in these Buckets. Trustifier.ai®, trained on 20 years of TrustLogic® application, helps you identify reasons why your audience can trust you in each Bucket and create trust-optimised solutions. It’s copy AI with substance."
|
| 547 |
)
|
|
@@ -576,101 +580,92 @@ def side():
|
|
| 576 |
""", unsafe_allow_html=True
|
| 577 |
)
|
| 578 |
st.markdown("For detailed descriptions, visit [Academy](https://www.trustifier.ai/account/academy)")
|
| 579 |
-
image_files = [
|
| 580 |
-
("Bucket_STABILITY.png", "Stability"),
|
| 581 |
-
("Bucket_DEVELOPMENT.png", "Development"),
|
| 582 |
-
("Bucket_RELATIONSHIP.png", "Relationship"),
|
| 583 |
-
("Bucket_BENEFIT.png", "Benefit"),
|
| 584 |
-
("Bucket_VISION.png", "Vision"),
|
| 585 |
-
("Bucket_COMPETENCE.png", "Competence"),]
|
| 586 |
-
st.markdown(
|
| 587 |
-
"""
|
| 588 |
-
<style>
|
| 589 |
-
:root {
|
| 590 |
-
--bg-color-light: white;
|
| 591 |
-
--bg-color-dark: black;
|
| 592 |
-
}
|
| 593 |
-
|
| 594 |
-
.image-container {
|
| 595 |
-
display: flex;
|
| 596 |
-
justify-content: center;
|
| 597 |
-
align-items: flex-start;
|
| 598 |
-
gap: 20px;
|
| 599 |
-
margin-top: 20px;
|
| 600 |
-
}
|
| 601 |
-
|
| 602 |
-
.image-wrapper {
|
| 603 |
-
position: relative;
|
| 604 |
-
text-align: center;
|
| 605 |
-
}
|
| 606 |
-
|
| 607 |
-
.image-wrapper img {
|
| 608 |
-
width: 100px;
|
| 609 |
-
height: auto;
|
| 610 |
-
background-color: var(--bg-color-light); /* Default light mode */
|
| 611 |
-
padding: 10px;
|
| 612 |
-
border-radius: 8px;
|
| 613 |
-
transition: transform 0.3s ease, background-color 0.3s ease;
|
| 614 |
-
}
|
| 615 |
-
|
| 616 |
-
[data-theme="dark"] .image-wrapper img {
|
| 617 |
-
background-color: var(--bg-color-dark); /* Adapt to dark mode */
|
| 618 |
-
}
|
| 619 |
-
|
| 620 |
-
.image-wrapper img:hover {
|
| 621 |
-
transform: scale(1.1); /* Zoom effect on hover */
|
| 622 |
-
cursor: pointer;
|
| 623 |
-
}
|
| 624 |
-
|
| 625 |
-
.hover-text {
|
| 626 |
-
position: absolute;
|
| 627 |
-
top: 50%;
|
| 628 |
-
left: 50%;
|
| 629 |
-
transform: translate(-50%, -50%);
|
| 630 |
-
color: rgba(0, 0, 0, 0); /* Invisible by default */
|
| 631 |
-
font-weight: bold;
|
| 632 |
-
font-size: 14px;
|
| 633 |
-
transition: color 0.3s ease;
|
| 634 |
-
}
|
| 635 |
-
|
| 636 |
-
[data-theme="dark"] .hover-text {
|
| 637 |
-
color: rgba(255, 255, 255, 0); /* Invisible in dark mode by default */
|
| 638 |
-
}
|
| 639 |
-
|
| 640 |
-
.image-wrapper:hover .hover-text {
|
| 641 |
-
color: rgba(0, 0, 0, 1); /* Visible on hover */
|
| 642 |
-
}
|
| 643 |
-
|
| 644 |
-
[data-theme="dark"] .image-wrapper:hover .hover-text {
|
| 645 |
-
color: rgba(255, 255, 255, 1); /* Visible in dark mode on hover */
|
| 646 |
-
}
|
| 647 |
-
</style>
|
| 648 |
-
""",
|
| 649 |
-
unsafe_allow_html=True,
|
| 650 |
-
)
|
| 651 |
-
|
| 652 |
-
# Dynamically generate the HTML for images and hover text
|
| 653 |
-
image_html = '<div class="image-container">'
|
| 654 |
-
for image_path, label in image_files:
|
| 655 |
-
image_html += f"""
|
| 656 |
-
<div class="image-wrapper">
|
| 657 |
-
<img src="data:image/png;base64,{open(image_path, 'rb').read().hex()}" alt="{label}">
|
| 658 |
-
<div class="hover-text">{label}</div>
|
| 659 |
-
</div>
|
| 660 |
-
"""
|
| 661 |
-
image_html += '</div>'
|
| 662 |
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
|
|
|
| 674 |
st.header("Upload Data source")
|
| 675 |
|
| 676 |
with st.form(key="upload_form"):
|
|
|
|
| 41 |
from firebase_admin import credentials, firestore
|
| 42 |
import base64
|
| 43 |
from pdfminer.high_level import extract_text # Import for PDF text extraction
|
| 44 |
+
from PIL import Image
|
| 45 |
|
| 46 |
st.set_page_config(layout="wide")
|
| 47 |
import logging
|
|
|
|
| 505 |
with st.sidebar:
|
| 506 |
|
| 507 |
with st.sidebar.expander("TrustLogic®", expanded=False):
|
| 508 |
+
st.image("Trust Logic_Wheel_RGB_Standard.png")
|
| 509 |
+
|
| 510 |
st.markdown(
|
| 511 |
"Our minds assess trust through Six Buckets of Trust® and determine their importance and order in a given situation. We then evaluate why we can or can’t trust someone in these Buckets. Trustifier.ai®, trained on 20 years of TrustLogic® application, helps you identify reasons why your audience can trust you in each Bucket and create trust-optimised solutions. It’s copy AI with substance."
|
| 512 |
)
|
|
|
|
| 541 |
""", unsafe_allow_html=True
|
| 542 |
)
|
| 543 |
st.markdown("For detailed descriptions, visit [Academy](https://www.trustifier.ai/account/academy)")
|
| 544 |
+
st.image("Trust Logic_Wheel_RGB_Standard.png")
|
| 545 |
+
|
| 546 |
+
st.sidebar.markdown('<hr style="border: 2px solid rgb(255, 153, 0); width: 80%; margin: 20px auto;">', unsafe_allow_html=True)
|
| 547 |
|
| 548 |
+
with st.sidebar.expander("Trust Buckets® and Trust Builders®", expanded=False):
|
| 549 |
st.markdown(
|
| 550 |
"Our minds assess trust through Six Buckets of Trust® and determine their importance and order in a given situation. We then evaluate why we can or can’t trust someone in these Buckets. Trustifier.ai®, trained on 20 years of TrustLogic® application, helps you identify reasons why your audience can trust you in each Bucket and create trust-optimised solutions. It’s copy AI with substance."
|
| 551 |
)
|
|
|
|
| 580 |
""", unsafe_allow_html=True
|
| 581 |
)
|
| 582 |
st.markdown("For detailed descriptions, visit [Academy](https://www.trustifier.ai/account/academy)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 583 |
|
| 584 |
+
st.image("Trust Logic_Wheel_RGB_Standard.png")
|
| 585 |
+
|
| 586 |
+
|
| 587 |
+
|
| 588 |
+
|
| 589 |
+
# Image paths and labels
|
| 590 |
+
image_files = [
|
| 591 |
+
("Bucket_STABILITY.png", "Stability"),
|
| 592 |
+
("Bucket_DEVELOPMENT.png", "Development"),
|
| 593 |
+
("Bucket_RELATIONSHIP.png", "Relationship"),
|
| 594 |
+
("Bucket_BENEFIT.png", "Benefit"),
|
| 595 |
+
("Bucket_VISION.png", "Vision"),
|
| 596 |
+
("Bucket_COMPETENCE.png", "Competence"),
|
| 597 |
+
]
|
| 598 |
+
|
| 599 |
+
# Compress images inline
|
| 600 |
+
compressed_dir = "compressed"
|
| 601 |
+
os.makedirs(compressed_dir, exist_ok=True)
|
| 602 |
+
compressed_images = []
|
| 603 |
+
for img_path, label in image_files:
|
| 604 |
+
compressed_path = os.path.join(compressed_dir, img_path)
|
| 605 |
+
if not os.path.exists(compressed_path): # Compress if not already done
|
| 606 |
+
with Image.open(img_path) as img:
|
| 607 |
+
img.save(compressed_path, optimize=True, quality=85)
|
| 608 |
+
compressed_images.append((compressed_path, label))
|
| 609 |
+
|
| 610 |
+
# CSS for layout and hover effect
|
| 611 |
+
st.markdown(
|
| 612 |
+
"""
|
| 613 |
+
<style>
|
| 614 |
+
.image-container {
|
| 615 |
+
display: flex;
|
| 616 |
+
justify-content: center;
|
| 617 |
+
gap: 20px;
|
| 618 |
+
}
|
| 619 |
+
.image-wrapper {
|
| 620 |
+
text-align: center;
|
| 621 |
+
position: relative;
|
| 622 |
+
}
|
| 623 |
+
.image-wrapper img {
|
| 624 |
+
width: 100px;
|
| 625 |
+
transition: transform 0.3s;
|
| 626 |
+
}
|
| 627 |
+
.image-wrapper img:hover {
|
| 628 |
+
transform: scale(1.1);
|
| 629 |
+
}
|
| 630 |
+
.hover-text {
|
| 631 |
+
position: absolute;
|
| 632 |
+
top: 110%;
|
| 633 |
+
left: 50%;
|
| 634 |
+
transform: translateX(-50%);
|
| 635 |
+
opacity: 0;
|
| 636 |
+
transition: opacity 0.3s;
|
| 637 |
+
font-size: 14px;
|
| 638 |
+
font-weight: bold;
|
| 639 |
+
}
|
| 640 |
+
.image-wrapper:hover .hover-text {
|
| 641 |
+
opacity: 1;
|
| 642 |
+
}
|
| 643 |
+
</style>
|
| 644 |
+
""",
|
| 645 |
+
unsafe_allow_html=True,
|
| 646 |
+
)
|
| 647 |
+
|
| 648 |
+
# Render images with hover text
|
| 649 |
+
image_html = '<div class="image-container">'
|
| 650 |
+
for img_path, label in compressed_images:
|
| 651 |
+
with open(img_path, "rb") as f:
|
| 652 |
+
img_data = f.read()
|
| 653 |
+
img_base64 = img_data.hex()
|
| 654 |
+
image_html += f"""
|
| 655 |
+
<div class="image-wrapper">
|
| 656 |
+
<img src="data:image/png;base64,{img_base64}" alt="{label}">
|
| 657 |
+
<div class="hover-text">{label}</div>
|
| 658 |
+
</div>
|
| 659 |
+
"""
|
| 660 |
+
image_html += "</div>"
|
| 661 |
+
st.markdown(image_html, unsafe_allow_html=True)
|
| 662 |
+
|
| 663 |
+
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
+
|
| 669 |
st.header("Upload Data source")
|
| 670 |
|
| 671 |
with st.form(key="upload_form"):
|