Testys commited on
Commit
73e894d
Β·
1 Parent(s): cb9097f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -202,15 +202,24 @@ def main():
202
  st.progress(float(row['similarity']))
203
 
204
  # Safe URL handling
205
- if is_valid_url(row['source']):
206
- st.markdown(
207
- f"<a class='source-link' href='{row['source']}' "
208
- f"target='_blank' rel='noopener noreferrer'>"
209
- f"🌐 View Source</a>",
210
- unsafe_allow_html=True
211
- )
212
- else:
213
- st.warning("Invalid source URL")
 
 
 
 
 
 
 
 
 
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:")