File size: 1,819 Bytes
a709b7a
 
 
 
 
19ba89e
a709b7a
 
 
 
 
 
 
 
19ba89e
 
a709b7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""drAIML 2.0.0 — open healthcare consultation. Runs in the browser via stlite on huggingface.co/spaces/PYTHAI/drAIML."""
import os

import streamlit as st

from draiml import __version__, state

st.set_page_config(page_title="drAIML — open healthcare consultation", page_icon="⚕️", layout="wide")

if "hf_token" not in st.session_state:  # token handed over by the page's "Sign in with Hugging Face"
    st.session_state.hf_token = os.environ.get("HF_TOKEN") or ""
    st.session_state.hf_user = os.environ.get("HF_USER") or ""
    st.session_state.hf_oauth = bool(st.session_state.hf_token)

state.start_loading()  # fetch the evidence index in the background while the visitor reads/types

pages = [
    st.Page("views/consult.py", title="Consultation", icon="🩺", default=True),
    st.Page("views/evidence.py", title="Evidence search", icon="🔎"),
    st.Page("views/models.py", title="Models", icon="🧠"),
    st.Page("views/datasets.py", title="Datasets", icon="📚"),
    st.Page("views/about.py", title="About · Oath", icon="⚕️"),
]
nav = st.navigation(pages)

with st.sidebar:
    st.markdown(f"### ⚕️ drAIML `{__version__}`")
    if st.session_state.hf_oauth:
        st.caption(f"Signed in as **{st.session_state.hf_user or 'Hugging Face user'}** — hosted models bill your HF account.")
    else:
        st.caption("Not signed in. Browse freely; to consult a hosted model, sign in with Hugging Face "
                   "(top bar) or bring a key.")

nav.run()

st.markdown(
    "<div style='margin-top:2rem;font-size:0.8rem;opacity:0.7'>drAIML provides information, not diagnosis. "
    "It does not replace a clinician. In an emergency call your local emergency number. · "
    "MIT · <a href='https://github.com/AIMLdr/drAIML'>v1 on GitHub</a></div>", unsafe_allow_html=True)