Update app.py
Browse files
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 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
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]:
|