Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -202,15 +202,24 @@ def main():
|
|
202 |
st.progress(float(row['similarity']))
|
203 |
|
204 |
# Safe URL handling
|
205 |
-
if
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
else:
|
215 |
st.warning("No matching documents found")
|
216 |
st.info("Try these tips:")
|
|
|
202 |
st.progress(float(row['similarity']))
|
203 |
|
204 |
# Safe URL handling
|
205 |
+
if row['source']:
|
206 |
+
src_lower = row['source'].lower()
|
207 |
+
if "cord" in src_lower:
|
208 |
+
# Link to a CORD-19 search page; adjust the URL as needed
|
209 |
+
url = "https://www.semanticscholar.org/search"
|
210 |
+
elif "arxiv" in src_lower:
|
211 |
+
# Link to the arXiv search page
|
212 |
+
url = "https://arxiv.org/search/"
|
213 |
+
else:
|
214 |
+
url = row['source']
|
215 |
+
if is_valid_url(url):
|
216 |
+
st.markdown(
|
217 |
+
f"<a class='source-link' href='{url}' target='_blank' rel='noopener noreferrer'>"
|
218 |
+
f"π View Source</a>",
|
219 |
+
unsafe_allow_html=True
|
220 |
+
)
|
221 |
+
else:
|
222 |
+
st.warning("Invalid source URL")
|
223 |
else:
|
224 |
st.warning("No matching documents found")
|
225 |
st.info("Try these tips:")
|