Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -157,27 +157,30 @@ st.markdown(f"**Found {len(valid_images)} matching shots**")
|
|
| 157 |
st.write("---")
|
| 158 |
|
| 159 |
# ==========================================
|
| 160 |
-
# 5. THE
|
| 161 |
# ==========================================
|
| 162 |
if len(valid_images) > 0:
|
| 163 |
-
# Pull the current limit from memory
|
| 164 |
current_limit = st.session_state.display_limit
|
| 165 |
display_list = valid_images[:current_limit]
|
| 166 |
|
| 167 |
-
# Anti-flicker fix: Drawing the grid explicitly row-by-row instead of flat columns
|
| 168 |
for i in range(0, len(display_list), 4):
|
| 169 |
cols = st.columns(4)
|
| 170 |
for j in range(4):
|
| 171 |
if i + j < len(display_list):
|
| 172 |
img_data = display_list[i + j]
|
| 173 |
with cols[j]:
|
| 174 |
-
st.image
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
# The Load More Button
|
| 183 |
if len(valid_images) > current_limit:
|
|
|
|
| 157 |
st.write("---")
|
| 158 |
|
| 159 |
# ==========================================
|
| 160 |
+
# 5. THE HTML GALLERY (Ultimate Anti-Flicker)
|
| 161 |
# ==========================================
|
| 162 |
if len(valid_images) > 0:
|
|
|
|
| 163 |
current_limit = st.session_state.display_limit
|
| 164 |
display_list = valid_images[:current_limit]
|
| 165 |
|
|
|
|
| 166 |
for i in range(0, len(display_list), 4):
|
| 167 |
cols = st.columns(4)
|
| 168 |
for j in range(4):
|
| 169 |
if i + j < len(display_list):
|
| 170 |
img_data = display_list[i + j]
|
| 171 |
with cols[j]:
|
| 172 |
+
# We bypass st.image and use pure HTML with loading="lazy"
|
| 173 |
+
html_card = f"""
|
| 174 |
+
<div style="margin-bottom: 15px;">
|
| 175 |
+
<img src='{img_data["url"]}' style='width: 100%; border-radius: 6px; display: block;' loading='lazy'>
|
| 176 |
+
<a href='{img_data["url"]}' target='_blank'>
|
| 177 |
+
<button style='width:100%; padding:8px; margin-top: 8px; border-radius:4px; border:1px solid #444; background:#222; color:white; cursor:pointer;'>
|
| 178 |
+
View Full Size
|
| 179 |
+
</button>
|
| 180 |
+
</a>
|
| 181 |
+
</div>
|
| 182 |
+
"""
|
| 183 |
+
st.markdown(html_card, unsafe_allow_html=True)
|
| 184 |
|
| 185 |
# The Load More Button
|
| 186 |
if len(valid_images) > current_limit:
|