Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
import subprocess
|
2 |
import sys
|
3 |
|
4 |
-
# Force reinstall pydantic v1 before
|
5 |
subprocess.run([sys.executable, "-m", "pip", "install", "--force-reinstall", "pydantic==1.10.7"])
|
6 |
|
7 |
import os
|
8 |
-
#
|
9 |
os.environ["HF_HUB_TIMEOUT"] = "60"
|
10 |
|
11 |
-
|
12 |
import streamlit as st
|
13 |
import streamlit.components.v1 as components
|
14 |
from backend import process_medical_query, docs_cache
|
@@ -20,21 +19,14 @@ def main():
|
|
20 |
"**Using BioGPT-Large-PubMedQA + PubMed + Chroma** for advanced retrieval-augmented generation."
|
21 |
)
|
22 |
|
|
|
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 |
final_answer, sub_questions, initial_answer, critique = process_medical_query(user_query)
|
27 |
|
28 |
-
st.subheader("
|
29 |
-
st.write(sub_questions)
|
30 |
-
|
31 |
-
st.subheader("Initial AI Answer")
|
32 |
-
st.write(initial_answer)
|
33 |
-
|
34 |
-
st.subheader("Self-Critique")
|
35 |
-
st.write(critique)
|
36 |
-
|
37 |
-
st.subheader("Refined AI Answer")
|
38 |
st.write(final_answer)
|
39 |
|
40 |
st.subheader("Knowledge Graph")
|
|
|
1 |
import subprocess
|
2 |
import sys
|
3 |
|
4 |
+
# Force reinstall pydantic v1 before any other imports to ensure compatibility with Chromadb.
|
5 |
subprocess.run([sys.executable, "-m", "pip", "install", "--force-reinstall", "pydantic==1.10.7"])
|
6 |
|
7 |
import os
|
8 |
+
# Set HF Hub timeout to 60 seconds.
|
9 |
os.environ["HF_HUB_TIMEOUT"] = "60"
|
10 |
|
|
|
11 |
import streamlit as st
|
12 |
import streamlit.components.v1 as components
|
13 |
from backend import process_medical_query, docs_cache
|
|
|
19 |
"**Using BioGPT-Large-PubMedQA + PubMed + Chroma** for advanced retrieval-augmented generation."
|
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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
st.write(final_answer)
|
31 |
|
32 |
st.subheader("Knowledge Graph")
|