File size: 2,412 Bytes
6145bc0
cbff2a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6145bc0
cbff2a0
 
 
 
 
6145bc0
cbff2a0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import streamlit as st
from agent.gemini_agent import run_gemini_chat
from agent.clinical_nlp import umls_concept_lookup, bioportal_concept_lookup
from quantum.optimizer import optimize_treatment

st.set_page_config(page_title="Quantum Healthcare AI", layout="wide")

st.markdown("""
    <div style='display:flex;align-items:center'>
        <img src='https://cdn-icons-png.flaticon.com/512/891/891419.png' width='56' style='margin-right:15px;'/>
        <h1 style='display:inline'>Quantum-AI Healthcare Assistant</h1>
    </div>
    """, unsafe_allow_html=True)

st.write("**Ask anything about symptoms, conditions, diagnosis, or optimal care. Get instant LLM answers, clinical concept mapping, and even quantum-inspired optimization.**")

query = st.text_area("Describe symptoms, a clinical problem, or a medical question:", height=70)

cols = st.columns([1,1])
with cols[0]:
    get_ai = st.button("Get AI & Clinical Insight")
with cols[1]:
    run_quantum = st.button("Quantum Optimize Care Plan")

if get_ai and query.strip():
    with st.spinner("Gemini AI is reviewing your query..."):
        ai_response = run_gemini_chat(query)
    st.markdown(f"**Gemini Agent:**\n\n{ai_response}")

    st.markdown("---")
    with st.expander("πŸ”Ž UMLS Concept Mapping"):
        concepts = umls_concept_lookup(query)
        if concepts:
            for c in concepts:
                if 'error' in c:
                    st.error(c['error'])
                else:
                    st.write(f"**{c['name']}**  |  ID: `{c['ui']}`  |  Source: *{c['rootSource']}*")
        else:
            st.info("No UMLS concepts found.")

    with st.expander("πŸ”¬ BioPortal Ontology Lookup"):
        concepts = bioportal_concept_lookup(query)
        if concepts:
            for c in concepts:
                if 'error' in c:
                    st.error(c['error'])
                else:
                    st.write(f"**{c['prefLabel']}**  |  [Ontology]({c['ontology']})  |  [Concept ID]({c['id']})")
        else:
            st.info("No BioPortal concepts found.")

if run_quantum and query.strip():
    with st.spinner("Quantum optimizer working..."):
        plan = optimize_treatment(query)
    st.markdown("### 🧬 Optimized Care Plan")
    st.json(plan)

st.markdown("---")
st.caption("Powered by Gemini LLM, UMLS, BioPortal, and quantum-inspired algorithms. For research use only. No patient data is stored.")