Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import subprocess
|
2 |
import sys
|
|
|
3 |
|
4 |
-
# Force reinstall pydantic v1
|
5 |
subprocess.run([sys.executable, "-m", "pip", "install", "--force-reinstall", "pydantic==1.10.7"])
|
6 |
|
7 |
-
|
8 |
-
# Set HF Hub timeout to 60 seconds.
|
9 |
os.environ["HF_HUB_TIMEOUT"] = "60"
|
10 |
|
11 |
import streamlit as st
|
@@ -14,16 +21,20 @@ from backend import process_medical_query, docs_cache
|
|
14 |
from visualization import create_medical_graph
|
15 |
|
16 |
def main():
|
|
|
|
|
17 |
st.title("AI-Powered Medical Knowledge Graph Assistant")
|
18 |
st.markdown(
|
19 |
-
"
|
|
|
|
|
|
|
|
|
20 |
)
|
21 |
|
22 |
-
# Clinical query input – designed for clarity and ease-of-use.
|
23 |
user_query = st.text_input("Enter biomedical/medical query", "Malaria and cough treatment")
|
24 |
if st.button("Submit"):
|
25 |
with st.spinner("Generating answer..."):
|
26 |
-
# Process the query using the streamlined backend.
|
27 |
final_answer, sub_questions, initial_answer, critique = process_medical_query(user_query)
|
28 |
|
29 |
st.subheader("AI Answer")
|
|
|
1 |
+
"""
|
2 |
+
app.py
|
3 |
+
------
|
4 |
+
This is the main Streamlit application. It provides a clinician-friendly interface to input a clinical query,
|
5 |
+
displays the generated answer, and visualizes key clinical concepts via an interactive knowledge graph.
|
6 |
+
"""
|
7 |
+
|
8 |
import subprocess
|
9 |
import sys
|
10 |
+
import os
|
11 |
|
12 |
+
# Force reinstall pydantic v1 to ensure compatibility with Chromadb.
|
13 |
subprocess.run([sys.executable, "-m", "pip", "install", "--force-reinstall", "pydantic==1.10.7"])
|
14 |
|
15 |
+
# Set the Hugging Face Hub timeout.
|
|
|
16 |
os.environ["HF_HUB_TIMEOUT"] = "60"
|
17 |
|
18 |
import streamlit as st
|
|
|
21 |
from visualization import create_medical_graph
|
22 |
|
23 |
def main():
|
24 |
+
st.set_page_config(page_title="AI-Powered Medical Knowledge Graph Assistant",
|
25 |
+
layout="wide")
|
26 |
st.title("AI-Powered Medical Knowledge Graph Assistant")
|
27 |
st.markdown(
|
28 |
+
"""
|
29 |
+
**Using BioGPT-Large-PubMedQA + PubMed + Chroma** for advanced retrieval-augmented generation.
|
30 |
+
|
31 |
+
Enter your clinical query below to retrieve and synthesize relevant medical literature.
|
32 |
+
"""
|
33 |
)
|
34 |
|
|
|
35 |
user_query = st.text_input("Enter biomedical/medical query", "Malaria and cough treatment")
|
36 |
if st.button("Submit"):
|
37 |
with st.spinner("Generating answer..."):
|
|
|
38 |
final_answer, sub_questions, initial_answer, critique = process_medical_query(user_query)
|
39 |
|
40 |
st.subheader("AI Answer")
|