Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -597,16 +597,7 @@ def side():
|
|
| 597 |
("Bucket_COMPETENCE.png", "Competence"),
|
| 598 |
]
|
| 599 |
|
| 600 |
-
#
|
| 601 |
-
compressed_dir = "compressed"
|
| 602 |
-
os.makedirs(compressed_dir, exist_ok=True)
|
| 603 |
-
compressed_images = []
|
| 604 |
-
for img_path, label in image_files:
|
| 605 |
-
compressed_path = os.path.join(compressed_dir, img_path)
|
| 606 |
-
if not os.path.exists(compressed_path): # Compress if not already done
|
| 607 |
-
with Image.open(img_path) as img:
|
| 608 |
-
img.save(compressed_path, optimize=True, quality=85)
|
| 609 |
-
compressed_images.append((compressed_path, label))
|
| 610 |
|
| 611 |
# CSS for layout and hover effect
|
| 612 |
st.markdown(
|
|
@@ -648,17 +639,6 @@ def side():
|
|
| 648 |
|
| 649 |
# Render images with hover text
|
| 650 |
image_html = '<div class="image-container">'
|
| 651 |
-
for img_path, label in compressed_images:
|
| 652 |
-
with open(img_path, "rb") as f:
|
| 653 |
-
img_data = f.read()
|
| 654 |
-
img_base64 = img_data.hex()
|
| 655 |
-
image_html += f"""
|
| 656 |
-
<div class="image-wrapper">
|
| 657 |
-
<img src="data:image/png;base64,{img_base64}" alt="{label}">
|
| 658 |
-
<div class="hover-text">{label}</div>
|
| 659 |
-
</div>
|
| 660 |
-
"""
|
| 661 |
-
image_html += "</div>"
|
| 662 |
st.markdown(image_html, unsafe_allow_html=True)
|
| 663 |
|
| 664 |
|
|
|
|
| 597 |
("Bucket_COMPETENCE.png", "Competence"),
|
| 598 |
]
|
| 599 |
|
| 600 |
+
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
|
| 602 |
# CSS for layout and hover effect
|
| 603 |
st.markdown(
|
|
|
|
| 639 |
|
| 640 |
# Render images with hover text
|
| 641 |
image_html = '<div class="image-container">'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
st.markdown(image_html, unsafe_allow_html=True)
|
| 643 |
|
| 644 |
|