Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -163,7 +163,6 @@ with tab1:
|
|
163 |
except Exception:
|
164 |
continue
|
165 |
|
166 |
-
# ------------------ Tab 2: Visual Search ------------------
|
167 |
# ------------------ Tab 2: Visual Search ------------------
|
168 |
with tab2:
|
169 |
st.title("🔍 Visual Reference Search")
|
@@ -218,7 +217,7 @@ with tab2:
|
|
218 |
st.markdown(st.session_state.image_response, unsafe_allow_html=True)
|
219 |
|
220 |
# Extract image filenames from assistant response
|
221 |
-
filename_matches = re.findall(r'Image Filename:\s*(
|
222 |
|
223 |
for fname in filename_matches:
|
224 |
if "Autopsy" in fname:
|
@@ -226,9 +225,10 @@ with tab2:
|
|
226 |
else:
|
227 |
folder = "JunqueirasBasicHistologyTextAtlas14thed.AnthonyMescher (2)"
|
228 |
|
|
|
229 |
encoded_folder = folder.replace(" ", "%20")
|
230 |
encoded_fname = fname.replace(" ", "%20")
|
231 |
-
url = f"https://raw.githubusercontent.com/AndrewLORTech/
|
232 |
|
233 |
try:
|
234 |
r = requests.get(url, timeout=5)
|
@@ -237,3 +237,4 @@ with tab2:
|
|
237 |
st.image(img, caption=fname, use_container_width=True)
|
238 |
except Exception:
|
239 |
st.warning(f"⚠️ Failed to load: {url}")
|
|
|
|
163 |
except Exception:
|
164 |
continue
|
165 |
|
|
|
166 |
# ------------------ Tab 2: Visual Search ------------------
|
167 |
with tab2:
|
168 |
st.title("🔍 Visual Reference Search")
|
|
|
217 |
st.markdown(st.session_state.image_response, unsafe_allow_html=True)
|
218 |
|
219 |
# Extract image filenames from assistant response
|
220 |
+
filename_matches = re.findall(r'Image Filename:\s*(.*?\.png)', st.session_state.image_response)
|
221 |
|
222 |
for fname in filename_matches:
|
223 |
if "Autopsy" in fname:
|
|
|
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:
|
234 |
r = requests.get(url, timeout=5)
|
|
|
237 |
st.image(img, caption=fname, use_container_width=True)
|
238 |
except Exception:
|
239 |
st.warning(f"⚠️ Failed to load: {url}")
|
240 |
+
|