Download index.html from PYTHAI/drAIML: direct link, hf CLI and curl.
- Browser
- Download file 18.7 kB
-
https://huggingface.co/spaces/PYTHAI/drAIML/resolve/main/index.html
- Command line
-
hf download hf://spaces/PYTHAI/drAIML/index.html
-
curl -L -o index.html https://huggingface.co/spaces/PYTHAI/drAIML/resolve/main/index.html
18.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>drAIML Consultation</title> | |
| <meta name="description" content="drAIML 2.0 — open-source healthcare consultation with open medical models and evidence from openly licensed datasets. Runs in your browser." /> | |
| <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><rect width='64' height='64' rx='14' fill='%230e7c7b'/><path d='M27 14h10v13h13v10H37v13H27V37H14V27h13z' fill='white'/></svg>" /> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@stlite/browser@1.12.1/build/stlite.css" /> | |
| <style> | |
| :root { | |
| --bg: #f6f8f8; --surface: #ffffff; --ink: #12302f; --muted: #557170; --accent: #0e7c7b; --accent-ink: #ffffff; | |
| --line: #d9e4e3; --warn: #b4232c; | |
| } | |
| @media (prefers-color-scheme: dark) { | |
| :root:not([data-theme="light"]) { | |
| --bg: #0d1716; --surface: #13201f; --ink: #e3efee; --muted: #93aeac; --accent: #3fb5b2; --accent-ink: #062120; | |
| --line: #22403e; --warn: #f07178; | |
| } | |
| } | |
| :root[data-theme="dark"] { | |
| --bg: #0d1716; --surface: #13201f; --ink: #e3efee; --muted: #93aeac; --accent: #3fb5b2; --accent-ink: #062120; | |
| --line: #22403e; --warn: #f07178; | |
| } | |
| html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); | |
| font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif; } | |
| body { display: flex; flex-direction: column; } | |
| header { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--surface); | |
| border-bottom: 1px solid var(--line); min-height: 48px; box-sizing: border-box; flex-wrap: wrap; } | |
| .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--ink); } | |
| .brand svg { width: 28px; height: 28px; flex: none; } | |
| .brand small { font-weight: 500; color: var(--muted); font-size: 0.8rem; } | |
| .spacer { flex: 1; } | |
| .who { color: var(--muted); font-size: 0.9rem; } | |
| [hidden] { display: none ; } | |
| button.hf { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); | |
| color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; } | |
| button.hf.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } | |
| button.hf:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } | |
| .sos { color: var(--warn); font-size: 0.85rem; font-weight: 600; } | |
| #root { flex: 1; min-height: 0; position: relative; } | |
| #boot { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--muted); } | |
| #boot .bar { width: min(320px, 80vw); height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 14px auto 0; } | |
| #boot .bar i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.4s ease-in-out infinite; } | |
| @keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } } | |
| @media (prefers-reduced-motion: reduce) { #boot .bar i { animation: none; width: 100%; } } | |
| @media (max-width: 560px) { .brand small, .sos { display: none; } } | |
| .chip { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); } | |
| .chip[data-state="ready"] { color: var(--accent); border-color: var(--accent); } | |
| dialog#bonsai-agreement { max-width: min(560px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--line); | |
| border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); } | |
| dialog#bonsai-agreement::backdrop { background: rgba(6, 20, 19, .55); } | |
| .agree { padding: 20px 22px 18px; max-height: calc(100vh - 64px); overflow-y: auto; box-sizing: border-box; } | |
| .agree h2 { margin: 0 0 4px; font-size: 1.2rem; } | |
| .agree .lede { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; } | |
| .agree h3 { margin: 14px 0 4px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } | |
| .agree p, .agree li { font-size: 0.93rem; line-height: 1.45; margin: 0 0 6px; } | |
| .agree ul { margin: 0; padding-left: 18px; } | |
| .agree a { color: var(--accent); } | |
| .agree .warn { color: var(--warn); font-weight: 600; } | |
| .agree .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; } | |
| .agree .prog { margin-top: 14px; font-size: 0.88rem; color: var(--muted); } | |
| .agree .prog b { display: block; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; } | |
| .agree .prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; } | |
| button.hf:disabled { opacity: .55; cursor: default; } | |
| #dmind-chip { cursor: pointer; } | |
| button.heart { border-color: var(--warn); color: var(--warn); } | |
| dialog.panel { max-width: min(620px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--line); border-radius: 14px; | |
| padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); } | |
| dialog.panel::backdrop { background: rgba(6, 20, 19, .55); } | |
| .dn { padding: 18px 22px 20px; max-height: calc(100vh - 64px); overflow-y: auto; box-sizing: border-box; } | |
| .dn header.top { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; min-height: 0; background: none; } | |
| .dn h2 { margin: 0; font-size: 1.2rem; flex: 1; } | |
| .dn h3 { margin: 18px 0 6px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } | |
| .dn p, .dn li, .dn label, .dn dd, .dn dt { font-size: 0.93rem; line-height: 1.45; } | |
| .dn .lede { margin: 4px 0 0; color: var(--muted); } | |
| .dn .card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 6px; } | |
| .dn .brand333 { font-weight: 700; letter-spacing: .02em; } | |
| .dn .brand333 span { color: var(--accent); } | |
| .dn ol.seq { margin: 8px 0 0; padding-left: 20px; color: var(--muted); } | |
| .dn ol.seq li[data-state="done"] { color: var(--accent); } | |
| .dn ol.seq li[data-state="done"]::after { content: " ✓"; } | |
| .dn .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; } | |
| .dn .share { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; } | |
| .dn .share input[type=range] { width: 100%; accent-color: var(--accent); } | |
| .dn .share select { font: inherit; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); } | |
| .dn .hint { color: var(--muted); font-size: 0.84rem; margin: 4px 0 0; } | |
| .dn dl { margin: 0; display: grid; gap: 4px; } | |
| .dn dl div { display: grid; grid-template-columns: 170px 1fr; gap: 10px; } | |
| .dn dt { color: var(--muted); } | |
| .dn dd { margin: 0; word-break: break-word; font-variant-numeric: tabular-nums; } | |
| .dn textarea, .dn input[type=text] { width: 100%; box-sizing: border-box; font: 0.85rem ui-monospace, monospace; padding: 6px; | |
| border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); } | |
| .dn details summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; margin-top: 8px; } | |
| .dn .state { font-weight: 600; margin: 4px 0 0; } | |
| .dn ul.claims { margin: 6px 0 0; padding-left: 18px; color: var(--muted); } | |
| .dn ul.claims a { color: var(--accent); margin-left: 4px; } | |
| @media (max-width: 560px) { .dn dl div { grid-template-columns: 1fr; gap: 0; } } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <a class="brand" href="https://huggingface.co/spaces/PYTHAI/drAIML" target="_top" aria-label="drAIML home"> | |
| <svg viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="14" fill="#0e7c7b"/><path d="M27 14h10v13h13v10H37v13H27V37H14V27h13z" fill="#fff"/></svg> | |
| <span>drAIML <small>2.0 · open healthcare consultation</small></span> | |
| </a> | |
| <span class="spacer"></span> | |
| <span class="sos">Emergency? Call your local emergency number.</span> | |
| <span class="chip" id="bonsai-chip" hidden role="status"></span> | |
| <button class="hf heart" id="donate-open" title="Donate compute to drAIML.dmind and earn SHAMBA LUV">❤️ Donate</button> | |
| <span class="chip" id="dmind-chip" hidden role="status" title="Your donation to drAIML.dmind: 1 LUV per token you generated"></span> | |
| <span class="who" id="who"></span> | |
| <button class="hf primary" id="signin" hidden>Sign in with Hugging Face</button> | |
| <button class="hf" id="signout" hidden>Sign out</button> | |
| </header> | |
| <div id="root"><div id="boot"><div><strong>Starting drAIML…</strong><br />Loading Python and Streamlit in your browser (first visit ≈ 20–40 s).<div class="bar"><i></i></div></div></div></div> | |
| <dialog id="donate" class="panel" aria-labelledby="dn-title"> | |
| <div class="dn"> | |
| <header class="top"><h2 id="dn-title">❤️ Help save lives · drAIML.dmind</h2><button class="hf" id="dn-close" aria-label="Close">✕</button></header> | |
| <p class="lede">Lend part of this computer to drAIML's distributed mind: it answers other people's health questions with | |
| Bonsai, in this browser, and you earn SHAMBA LUV for every token it writes.</p> | |
| <h3>1 · Sign in</h3> | |
| <div class="card" id="dn-signin"> | |
| <div class="brand333">login333 · <span>drAIML</span></div> | |
| <p class="hint">Sign one message with your wallet to prove the key is yours. No transaction, no gas, nothing moves. | |
| Your payouts go to this wallet.</p> | |
| <div class="row"><button class="hf primary" id="dn-go">Begin the HANDSHAKE</button></div> | |
| <ol class="seq" id="dn-seq" hidden> | |
| <li data-k="wallet">Wallet connected</li><li data-k="nonce">One-time code issued</li> | |
| <li data-k="sign">HANDSHAKE signed</li><li data-k="verify">Signature checked by drAIML.dmind</li><li data-k="open">Signed in</li> | |
| </ol> | |
| <details id="dn-manual"><summary>No browser wallet? Sign elsewhere and paste the signature</summary> | |
| <p class="hint">Your wallet address:</p><input type="text" id="dn-addr" placeholder="0x…" autocomplete="off" /> | |
| <div class="row"><button class="hf" id="dn-manual-go">Get the message to sign</button></div> | |
| <textarea id="dn-msg" rows="7" readonly aria-label="Message to sign"></textarea> | |
| <p class="hint">Signature (0x…):</p><input type="text" id="dn-sig" autocomplete="off" /> | |
| <div class="row"><button class="hf primary" id="dn-verify" hidden>Verify</button></div> | |
| </details> | |
| <p class="hint" id="dn-login-status" role="status"></p> | |
| </div> | |
| <div class="card" id="dn-signed" hidden> | |
| <div class="brand333">login333 · <span>drAIML</span> ✓</div> | |
| <p class="hint">Signed in as <code id="dn-who"></code></p> | |
| <div class="row"><button class="hf" id="dn-signout">Sign out</button></div> | |
| </div> | |
| <h3>2 · What to share</h3> | |
| <div class="card share"> | |
| <input type="checkbox" id="dn-cpu-on" checked aria-label="Share CPU" /><label for="dn-cpu">CPU <input type="range" id="dn-cpu" min="5" max="50" step="5" value="10" /></label><b id="dn-cpu-val">10%</b> | |
| <input type="checkbox" id="dn-ram-on" checked aria-label="Share RAM" /><label for="dn-ram">RAM · largest job | |
| <select id="dn-ram"><option value="128">small (128 tokens)</option><option value="256" selected>medium (256 tokens)</option><option value="512">large (512 tokens)</option></select></label><span></span> | |
| <input type="checkbox" id="dn-gpu-on" aria-label="Share GPU" /><label for="dn-gpu">GPU <input type="range" id="dn-gpu" min="25" max="100" step="5" value="25" /></label><b id="dn-gpu-val">25%</b> | |
| </div> | |
| <p class="hint">No graphics card found, or not sure? <a href="webgpu/index.html" id="dn-gpu-check" target="_blank" rel="noopener">Check this browser's graphics card</a>. The drAIML WebGPU helper shows how to switch WebGPU on.</p> | |
| <p class="hint" id="dn-need" hidden>CPU and RAM are both needed to donate: Bonsai runs on the processor and stays in memory.</p> | |
| <div class="row"><button class="hf primary" id="dn-review">Review and start donating</button><button class="hf" id="dn-stop" hidden>Stop donating</button></div> | |
| <p class="state" id="dn-state" role="status"></p> | |
| <h3>3 · Measured</h3> | |
| <div class="card"><dl id="dn-measure"></dl></div> | |
| <h3>4 · Earnings and payout</h3> | |
| <div class="card"><dl id="dn-earn"></dl> | |
| <div class="row"><button class="hf primary" id="dn-payout" disabled>Request payout</button></div> | |
| <p class="hint" id="dn-pay-status" role="status"></p> | |
| <ul class="claims" id="dn-claims"></ul> | |
| <p class="hint">1 SHAMBA LUV (0x2711…8254, Ethereum) per generated token, counted to 18 decimals (SCIEN·TIFIC). | |
| Rewards are paid in SHAMBA LUV only, sent by the drAIML operator from the ledger in batches.</p> | |
| </div> | |
| </div> | |
| </dialog> | |
| <dialog id="dn-confirm" class="panel" aria-labelledby="dn-confirm-title"> | |
| <div class="dn"> | |
| <h2 id="dn-confirm-title">Confirm what this computer shares</h2> | |
| <ul id="dn-confirm-list"></ul> | |
| <p class="hint">You can change or stop this at any time from ❤️ Donate. Nothing runs when this tab is closed.</p> | |
| <div class="row"><button class="hf" id="dn-confirm-no">Cancel</button><button class="hf primary" id="dn-confirm-yes">Confirm and donate</button></div> | |
| </div> | |
| </dialog> | |
| <dialog id="bonsai-agreement" aria-labelledby="agree-title"> | |
| <div class="agree"> | |
| <h2 id="agree-title">drAIML agreement</h2> | |
| <p class="lede">Before drAIML puts a medical consultation model inside your browser, please read and agree.</p> | |
| <h3>What happens</h3> | |
| <ul> | |
| <li>drAIML downloads <a href="https://huggingface.co/prism-ml/Bonsai-1.7B-gguf" target="_blank" rel="noopener">Bonsai-1.7B</a> | |
| (1-bit, 248 MB) once, from Prism ML's Hugging Face repository at a fixed revision, checks it against its published | |
| sha256 and keeps it in this browser's storage.</li> | |
| <li>The <a href="https://github.com/browseML/browseML" target="_blank" rel="noopener">browseML</a> engine runs it on your | |
| own computer. What you type is not sent anywhere: no server, no account, no key, no cost.</li> | |
| <li>drAIML's open medical evidence is searched in your browser and given to the model with your question.</li> | |
| </ul> | |
| <h3>Your health</h3> | |
| <ul> | |
| <li>drAIML gives information, <strong>not a diagnosis</strong>, and does not replace a doctor, physiotherapist or therapist.</li> | |
| <li>Bonsai is a small model: it is quick and private, but makes mistakes more often than large models. Check anything | |
| important with a clinician.</li> | |
| <li class="warn">In an emergency, call your local emergency number now.</li> | |
| </ul> | |
| <h3>Licences</h3> | |
| <p>Bonsai-1.7B © Prism ML, Apache-2.0, built from Qwen3-1.7B (Apache-2.0). Created using Bonsai by Prism ML. | |
| browseML: MIT or Apache-2.0. drAIML: MIT.</p> | |
| <p>You can remove the model at any time with <em>Remove</em> under Engine in the sidebar.</p> | |
| <div class="prog" data-progress hidden role="status" aria-live="polite"><span></span><b><i></i></b></div> | |
| <div class="row"> | |
| <button class="hf" data-decline>Not now</button> | |
| <button class="hf primary" data-agree>I agree — download 248 MB and start</button> | |
| </div> | |
| </div> | |
| </dialog> | |
| <script type="module"> | |
| import { mount } from "https://cdn.jsdelivr.net/npm/@stlite/browser@1.12.1/build/stlite.js"; | |
| import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "https://cdn.jsdelivr.net/npm/@huggingface/hub@2.17.10/+esm"; | |
| import { startBridge, captureWorkers } from "./bonsai.js"; | |
| import { init as initDonate } from "./donate.js"; | |
| // this tab's id: Python (in its Web Worker) and this page find each other by it over a BroadcastChannel | |
| const PAGE_ID = (crypto.randomUUID && crypto.randomUUID()) || String(Math.random()).slice(2); | |
| captureWorkers(PAGE_ID); // before mount: Python reaches this page through a port on its worker | |
| startBridge(PAGE_ID, { signin: () => document.getElementById("signin").click() }); | |
| initDonate(); | |
| const KEY = "draiml-oauth"; | |
| const vars = (window.huggingface && window.huggingface.variables) || {}; | |
| const canOAuth = Boolean(vars.OAUTH_CLIENT_ID); | |
| function readSession() { | |
| try { | |
| const s = JSON.parse(localStorage.getItem(KEY) || "null"); | |
| if (s && s.accessToken && (!s.accessTokenExpiresAt || new Date(s.accessTokenExpiresAt) > new Date())) return s; | |
| } catch (_) { /* storage blocked */ } | |
| return null; | |
| } | |
| let session = null; | |
| try { | |
| const fresh = await oauthHandleRedirectIfPresent(); | |
| if (fresh) { | |
| session = fresh; | |
| try { localStorage.setItem(KEY, JSON.stringify(fresh)); } catch (_) {} | |
| history.replaceState(null, "", location.pathname); | |
| } | |
| } catch (e) { console.warn("[drAIML] oauth redirect", e); } | |
| session = session || readSession(); | |
| const who = document.getElementById("who"); | |
| const signin = document.getElementById("signin"); | |
| const signout = document.getElementById("signout"); | |
| if (session) { | |
| const u = session.userInfo || {}; | |
| who.textContent = u.preferred_username || u.name || ""; | |
| signout.hidden = false; | |
| } else if (canOAuth) { | |
| signin.hidden = false; | |
| } | |
| signin.onclick = async () => { | |
| location.href = (await oauthLoginUrl({ scopes: vars.OAUTH_SCOPES || "openid profile inference-api" })) + "&prompt=consent"; | |
| }; | |
| signout.onclick = () => { try { localStorage.removeItem(KEY); } catch (_) {} location.reload(); }; | |
| const manifest = await (await fetch("app/manifest.json", { cache: "no-cache" })).json(); | |
| const files = {}; | |
| for (const p of manifest.files) files[p] = { url: "app/" + p + "?v=" + manifest.build }; | |
| const env = { DRAIML_PAGE_ID: PAGE_ID }; | |
| if (canOAuth && !session) env.DRAIML_OAUTH = "1"; | |
| if (["127.0.0.1", "localhost"].includes(location.hostname)) { | |
| env.DRAIML_EVIDENCE_BASE = location.origin + "/build/evidence"; // local development: serve the index you built | |
| } | |
| if (session) { | |
| env.HF_TOKEN = session.accessToken; | |
| const u = session.userInfo || {}; | |
| env.HF_USER = u.preferred_username || u.name || ""; | |
| } | |
| const dark = document.documentElement.dataset.theme === "dark" || | |
| (!document.documentElement.dataset.theme && matchMedia("(prefers-color-scheme: dark)").matches); | |
| document.getElementById("boot").remove(); | |
| mount({ | |
| entrypoint: "app.py", | |
| files, | |
| requirements: manifest.requirements || [], | |
| env, | |
| streamlitConfig: { | |
| "client.toolbarMode": "viewer", | |
| "theme.base": dark ? "dark" : "light", | |
| "theme.primaryColor": dark ? "#3fb5b2" : "#0e7c7b", | |
| }, | |
| }, document.getElementById("root")); | |
| </script> | |
| </body> | |
| </html> | |