Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -220,7 +220,7 @@ with tab2:
|
|
220 |
filename_matches = re.findall(r'Image Filename:\s*(.*?\.png)', st.session_state.image_response)
|
221 |
|
222 |
for fname in filename_matches:
|
223 |
-
#
|
224 |
parts = fname.split("_page_")
|
225 |
if len(parts) > 1:
|
226 |
folder = parts[0]
|
@@ -228,11 +228,10 @@ with tab2:
|
|
228 |
st.warning(f"⚠️ Could not determine folder for: {fname}")
|
229 |
continue
|
230 |
|
231 |
-
#
|
232 |
-
encoded_folder = folder.replace(" ", "%20")
|
233 |
-
encoded_fname = fname.replace(" ", "%20")
|
234 |
|
235 |
-
# ✅ Construct valid GitHub raw URL
|
236 |
url = f"https://raw.githubusercontent.com/AndrewLORTech/witspathologaihisto/main/{encoded_folder}/{encoded_fname}"
|
237 |
|
238 |
try:
|
|
|
220 |
filename_matches = re.findall(r'Image Filename:\s*(.*?\.png)', st.session_state.image_response)
|
221 |
|
222 |
for fname in filename_matches:
|
223 |
+
# Extract folder from filename prefix (before _page_)
|
224 |
parts = fname.split("_page_")
|
225 |
if len(parts) > 1:
|
226 |
folder = parts[0]
|
|
|
228 |
st.warning(f"⚠️ Could not determine folder for: {fname}")
|
229 |
continue
|
230 |
|
231 |
+
# Only encode spaces — leave parentheses untouched to match GitHub structure
|
232 |
+
encoded_folder = folder.replace(" ", "%20")
|
233 |
+
encoded_fname = fname.replace(" ", "%20")
|
234 |
|
|
|
235 |
url = f"https://raw.githubusercontent.com/AndrewLORTech/witspathologaihisto/main/{encoded_folder}/{encoded_fname}"
|
236 |
|
237 |
try:
|