IAMTFRMZA commited on
Commit
befd3de
·
verified ·
1 Parent(s): 2aeaf4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -150,16 +150,15 @@ with chat_col:
150
  with st.chat_message(msg["role"]):
151
  st.markdown(msg["content"], unsafe_allow_html=True)
152
 
153
- # ------------------ Image Preview ------------------
154
  with image_col:
155
  if show_image and st.session_state.image_urls:
156
  st.markdown("### 🖼️ Slide Previews")
157
  for raw_url in st.session_state.image_urls:
158
  try:
159
- # Directly use the raw GitHub URL as-is
160
- r = requests.get(raw_url)
161
  r.raise_for_status()
162
  img = Image.open(BytesIO(r.content))
163
  st.image(img, caption=f"📷 {raw_url.split('/')[-1]}", use_container_width=True)
164
- except Exception as e:
165
- st.error(f"❌ Failed to load image from {raw_url}: {e}")
 
150
  with st.chat_message(msg["role"]):
151
  st.markdown(msg["content"], unsafe_allow_html=True)
152
 
153
+ # ------------------ Image Preview (Silent Fails) ------------------
154
  with image_col:
155
  if show_image and st.session_state.image_urls:
156
  st.markdown("### 🖼️ Slide Previews")
157
  for raw_url in st.session_state.image_urls:
158
  try:
159
+ r = requests.get(raw_url, timeout=5)
 
160
  r.raise_for_status()
161
  img = Image.open(BytesIO(r.content))
162
  st.image(img, caption=f"📷 {raw_url.split('/')[-1]}", use_container_width=True)
163
+ except Exception:
164
+ continue # Silently skip broken images