Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from interm import generate_clinical_content, generate_summary, generate_soap_note, save_as_text, save_as_pdf
|
3 |
+
|
4 |
+
# Title & Introduction
|
5 |
+
st.title("🩺 AI-Powered Clinical Intelligence Assistant")
|
6 |
+
st.write("Revolutionizing **clinical documentation, research summarization, and medical education** using AI.")
|
7 |
+
|
8 |
+
# Tabs for different functionalities
|
9 |
+
tabs = st.tabs(["📝 Clinical Content", "📑 Research Summaries", "🩺 SOAP Notes", "📊 Medical Reports"])
|
10 |
+
|
11 |
+
# Tab 1: Generate Clinical Content
|
12 |
+
with tabs[0]:
|
13 |
+
st.header("Generate Medical Articles & Patient Education")
|
14 |
+
|
15 |
+
prompt = st.text_area("Enter a Medical Topic (e.g., AI in Radiology, Hypertension Management):")
|
16 |
+
target_audience = st.selectbox("Select Audience:", ["Clinicians", "Patients", "Researchers"])
|
17 |
+
|
18 |
+
if st.button("Generate Content"):
|
19 |
+
if prompt:
|
20 |
+
with st.spinner("Generating medical content..."):
|
21 |
+
result = generate_clinical_content(prompt, target_audience)
|
22 |
+
st.session_state["medical_content"] = result
|
23 |
+
st.subheader("Generated Medical Content")
|
24 |
+
st.write(result)
|
25 |
+
else:
|
26 |
+
st.warning("Please enter a medical topic.")
|
27 |
+
|
28 |
+
# Tab 2: Summarize Research
|
29 |
+
with tabs[1]:
|
30 |
+
st.header("Summarize Clinical Trials & Medical Research")
|
31 |
+
|
32 |
+
if "medical_content" in st.session_state:
|
33 |
+
if st.button("Generate Summary"):
|
34 |
+
with st.spinner("Summarizing medical research..."):
|
35 |
+
summary = generate_summary(st.session_state["medical_content"])
|
36 |
+
st.session_state["research_summary"] = summary
|
37 |
+
st.subheader("Clinical Summary")
|
38 |
+
st.markdown(summary)
|
39 |
+
else:
|
40 |
+
st.warning("Generate content in Tab 1 first.")
|
41 |
+
|
42 |
+
# Tab 3: SOAP Notes Generator
|
43 |
+
with tabs[2]:
|
44 |
+
st.header("Generate SOAP Notes for Patient Consultations")
|
45 |
+
|
46 |
+
symptoms = st.text_area("Enter Symptoms (e.g., fever, cough, chest pain):")
|
47 |
+
patient_history = st.text_area("Brief Patient History:")
|
48 |
+
|
49 |
+
if st.button("Generate SOAP Note"):
|
50 |
+
if symptoms:
|
51 |
+
with st.spinner("Generating SOAP Note..."):
|
52 |
+
soap_note = generate_soap_note(symptoms, patient_history)
|
53 |
+
st.session_state["soap_note"] = soap_note
|
54 |
+
st.subheader("Generated SOAP Note")
|
55 |
+
st.code(soap_note, language="text")
|
56 |
+
else:
|
57 |
+
st.warning("Please enter patient symptoms.")
|
58 |
+
|
59 |
+
# Tab 4: Download Clinical Reports
|
60 |
+
with tabs[3]:
|
61 |
+
st.header("Download Clinical Reports")
|
62 |
+
|
63 |
+
if "soap_note" in st.session_state:
|
64 |
+
report_content = st.session_state["soap_note"]
|
65 |
+
text_file_path, text_filename = save_as_text(report_content, "Medical_Report.txt")
|
66 |
+
pdf_file_path, pdf_filename = save_as_pdf(report_content, "Medical_Report.pdf")
|
67 |
+
|
68 |
+
with open(text_file_path, "rb") as file:
|
69 |
+
st.download_button("Download Report as TXT", data=file, file_name=text_filename, mime="text/plain")
|
70 |
+
|
71 |
+
with open(pdf_file_path, "rb") as file:
|
72 |
+
st.download_button("Download Report as PDF", data=file, file_name=pdf_filename, mime="application/pdf")
|