mgbam commited on
Commit
cc1d6cf
·
verified ·
1 Parent(s): 3c2582f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -168,10 +168,15 @@ def render_ui():
168
  # --- TAB 2: Knowledge Graph ---
169
  with tabs[1]:
170
  st.markdown("#### Explore Connections")
171
- kg_html_path = build_knowledge_graph(results["papers"], results["umls"], results["drug_safety"])
172
- with open(kg_html_path, 'r', encoding='utf-8') as f:
173
- kg_html = f.read()
174
- components.html(kg_html, height=600)
 
 
 
 
 
175
 
176
  # --- TAB 3: Visualizations ---
177
  with tabs[2]:
 
168
  # --- TAB 2: Knowledge Graph ---
169
  with tabs[1]:
170
  st.markdown("#### Explore Connections")
171
+ try:
172
+ kg_html_path = build_knowledge_graph(results["papers"], results["umls"], results["drug_safety"])
173
+ with open(kg_html_path, 'r', encoding='utf-8') as f:
174
+ kg_html = f.read()
175
+ components.html(kg_html, height=600)
176
+ except Exception as e:
177
+ st.warning("⚠️ Knowledge graph visualization is unavailable. "
178
+ "Please ensure 'pyvis' and 'jinja2' are installed. "
179
+ f"Error: {e}")
180
 
181
  # --- TAB 3: Visualizations ---
182
  with tabs[2]: