IAMTFRMZA commited on
Commit
6d838fa
·
verified ·
1 Parent(s): 38e8608

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -225,9 +225,9 @@ with tab2:
225
  else:
226
  folder = "JunqueirasBasicHistologyTextAtlas14thed.AnthonyMescher (2)"
227
 
228
- # Encode URL parts for raw access
229
- encoded_folder = folder.replace(" ", "%20")
230
- encoded_fname = fname.replace(" ", "%20")
231
  url = f"https://raw.githubusercontent.com/AndrewLORTech/witspathologaihisto/main/{encoded_folder}/{encoded_fname}"
232
 
233
  try:
@@ -236,5 +236,4 @@ with tab2:
236
  img = Image.open(BytesIO(r.content))
237
  st.image(img, caption=fname, use_container_width=True)
238
  except Exception:
239
- st.warning(f"⚠️ Failed to load: {url}")
240
-
 
225
  else:
226
  folder = "JunqueirasBasicHistologyTextAtlas14thed.AnthonyMescher (2)"
227
 
228
+ # Encode special characters in folder and filename
229
+ encoded_folder = folder.replace(" ", "%20").replace("(", "%28").replace(")", "%29")
230
+ encoded_fname = fname.replace(" ", "%20").replace("(", "%28").replace(")", "%29")
231
  url = f"https://raw.githubusercontent.com/AndrewLORTech/witspathologaihisto/main/{encoded_folder}/{encoded_fname}"
232
 
233
  try:
 
236
  img = Image.open(BytesIO(r.content))
237
  st.image(img, caption=fname, use_container_width=True)
238
  except Exception:
239
+ st.warning(f"⚠️ Failed to load: {url}")