| title | AI PHQ-9 Prototype |
|---|---|
| emoji | 🩺 |
| colorFrom | green |
| colorTo | gray |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
A responsive web version of the prototype: conversational (AI) and standard administration, multilingual (English, Malay, Mandarin, Tamil), live severity scoring, item-9 safety flagging, an instant AI clinical summary, voice input, and a consent-gated clinician handoff (WhatsApp / print-to-PDF). Works on phone and desktop. Demonstration only — not a medical device, not for clinical use.
The small server (server.js) serves the app and relays model calls so your
API key stays on the server and never reaches the browser.
The app works with either provider — you set one key, the server does the rest. Nothing in the app itself changes.
- Go to aistudio.google.com, sign in with a normal Google account.
- Click Get API key → Create API key. No credit card, no billing setup.
- In Render → your service → Environment, add:
- Key:
GEMINI_API_KEYValue: the key you just created. - (If an
ANTHROPIC_API_KEYis already there, delete it, or addPROVIDER=gemini.)
- Key:
- Save. Render redeploys itself. Done — the conversation will work.
Free tier is roughly 1,500 requests/day, which is far more than enough for demos. Limits and terms change — check Google's current pricing page.
Important caveat: on Google's free tier, prompts may be used to improve their products. Fine for demonstrating with a fictional persona. Never put real patient data through the free tier — for real fieldwork use a paid/enterprise tier with data-processing terms, under your ethics approval.
Needs API credit on the account. Note a Claude Pro subscription does NOT include
API credit — they are separate products. Add credit at console.anthropic.com →
Billing, then set ANTHROPIC_API_KEY in Render.
Optional overrides: PROVIDER (gemini or anthropic), GEMINI_MODEL, MODEL.
- An API key from whichever provider you picked above.
- If you are on a paid provider, set a monthly spending limit on the key before sharing the link publicly. The app includes basic rate-limiting, but a spend cap is your real safety net. (Not needed on Gemini's free tier.)
- Sign in at huggingface.co → New → Space.
- Name it, pick a licence, set Space SDK = Docker (blank template), Create.
- Open the Files tab → Add file → Upload files. Upload everything in this
folder, keeping the structure:
server.js,package.json,Dockerfile,README.md, and thepublic/folder (withindex.htmlandmanifest.webmanifestinside it). - Go to Settings → Variables and secrets → New secret:
- Name:
GEMINI_API_KEY(orANTHROPIC_API_KEY) · Value: your key. Save. Use secret, not variable.
- Name:
- The Space builds automatically. When the status reads Running, the Space URL at the top is your shareable link — send it to your CMO or funder, or open it on your phone.
(This README's top section is the Hugging Face Space config — leave it in place.)
- Put these files in a GitHub repo.
- Render → New → Web Service → connect the repo.
- It detects Node. Build command
npm install, start commandnode server.js. - Environment → Add
ANTHROPIC_API_KEY(and optionallyMODEL). - Deploy → use the onrender.com URL it gives you.
npm install
export GEMINI_API_KEY=your-key # Windows PowerShell: $env:GEMINI_API_KEY="your-key"
npm start
# open http://localhost:7860- On a phone, the app shows an Add to Home Screen prompt on the opening screen — Android offers a one-tap Install, iOS shows the Share → Add to Home Screen steps. It then opens full-screen with its own icon. Because it's a real page (not the in-chat preview), the microphone, print-to-PDF, and WhatsApp handoff all work.
- Model: defaults to
gemini-2.5-flashwhen a Gemini key is set, otherwiseclaude-sonnet-5. Override withGEMINI_MODEL/MODEL. Model names, limits and pricing evolve — check the provider's current docs. - Health check: visit
/healthzon your deployed URL to confirm which provider and model the server is using and whether it can see your key. - Privacy: the app stores nothing; responses live only in the browser tab until it's closed. The moment you add saving/logging, it becomes governed research (ethics approval, PDPA, secure storage) — build that under an approved protocol, not here.
- Safety: crisis resources shown in-app are Singapore-specific (SOS 1767, mindline.sg, IMH 6389 2222). Adjust if your audience is elsewhere.