--- title: Chhaya — Shade For Those Who Work In The Sun emoji: ⛱️ colorFrom: yellow colorTo: red sdk: gradio sdk_version: 5.49.1 app_file: app.py pinned: true license: apache-2.0 short_description: MedGemma skin & heat-health companion for outdoor workers tags: - track:backyard - achievement:tiny-titan - achievement:well-tuned - achievement:sharing - achievement:offgrid - achievement:off-brand - achievement:best-demo - sponsor:modal - build-small-hackathon - backyard ai - backyard-ai - tiny titan - tiny-titan - well tuned - well-tuned - sharing is caring - sharing-is-caring - off the grid - off-the-grid - best demo - best-demo - off brand - off-brand - modal - best use of modal - best-use-of-modal - medgemma - kokoro - healthcare - gradio - zerogpu models: - google/medgemma-1.5-4b-it - build-small-hackathon/chhaya-medgemma-lora - hexgrad/Kokoro-82M datasets: - build-small-hackathon/chhaya-skin-extract --- # Chhaya (छाया — "shade") ⛱️ **A skin & heat-health companion for the people who work in the sun** — drivers, delivery riders, construction workers, street vendors, farmers. Heat waves are making outdoor work harsher every year, and the people most exposed to sun damage are the least likely to ever get a skin check. Chhaya is a small, free tool for exactly those hours. **Built for the Hugging Face Build Small Hackathon (Backyard AI track).** ▶️ **Demo videos:** [Full walkthrough (4.5 min)](https://youtu.be/-4Fh8WYlUbo) · [90-second cut](https://youtu.be/0465erKuv7Y) 📝 **Blog:** [Chhaya: teaching a 4B model to be the eyes, not the doctor →](https://huggingface.co/blog/build-small-hackathon/chhaya-blog) 📄 [Launch post on LinkedIn →](https://www.linkedin.com/posts/manjunathan-r-06396b1b7_buildsmallhackathon-medgemma-healthtech-share-7472213562757734400-cZby/) ## What it does 1. **☀️ Skin check** — snap a photo of any spot or patch of skin. **MedGemma-1.5-4B** describes what it sees (type, colour, borders, symmetry, texture), flags how concerning it looks (`looks ordinary` / `worth watching` / `show a doctor`), and spots visible sun & heat damage. 2. **Plans built around *your* work day** — tell Chhaya your occupation, hours in direct sun, and water access; it builds a hydration schedule and protection plan that fits (drivers learn about window-side UV, riders about helmet-line burns, construction workers about NDMA work-hour guidance). 3. **🌡️ Heat symptom check** — first-aid triage for heat cramps / heat exhaustion / heatstroke. Deliberately **zero AI**: pure deterministic logic from NDMA / WHO first-aid guidance, because emergencies are not the place for sampling. 4. **🗂️ My record** — save checks per body part within the session and re-compare the same spot over time. The spot that *changes* is the spot that matters. 5. **🔊 Read it aloud** — every verdict and the heat first-aid steps can be spoken with one tap (Kokoro-82M, on CPU), in **English or Hindi**, so the plan reaches workers who don't read English easily. 6. **👆 One-tap sample workers** — preloaded persona cards (a bike-taxi rider, an auto driver, a vendor, a farmer) prefill a real skin photo + work-day context and run the check instantly, so anyone can try Chhaya without uploading. Sample photos are open-license images from ISIC + Google SCIN; names/jobs are fictional. ## Design principle: the model is the eyes, the guidelines are the medicine MedGemma reads the photo and returns a structured description — that's all it's trusted with. Every medical number and action (litres per shift, ORS timing, 12–3 pm shade window, when to call 108/112) is curated, deterministic content from: - **NDMA India** heat-action / heat-illness first-aid guidance - **WHO** heat-health advice - **Cancer Council ABCDE** skin self-check criteria (Asymmetry, Border, Colour, Diameter, Evolving) The model never invents medical advice. Chhaya describes — it never diagnoses. ## Stack - **Vision model:** [`google/medgemma-1.5-4b-it`](https://huggingface.co/google/medgemma-1.5-4b-it) (4B, image-text-to-text, bf16) — well under the 32B cap — served with our **fine-tuned LoRA adapter** [`build-small-hackathon/chhaya-medgemma-lora`](https://huggingface.co/build-small-hackathon/chhaya-medgemma-lora) - **Speech:** [`hexgrad/Kokoro-82M`](https://huggingface.co/hexgrad/Kokoro-82M) text-to-speech, run on **CPU** so read-aloud never touches the GPU quota - **Training data:** [`build-small-hackathon/chhaya-skin-extract`](https://huggingface.co/datasets/build-small-hackathon/chhaya-skin-extract) — built from ISIC-2024 (biopsy-anchored) + Google SCIN (phone photos, Monk skin tones 1–7) - **Fine-tune compute:** QLoRA on **Modal** (~$6 of credits, v1 + v2) - **Runtime:** Gradio on Hugging Face Spaces **ZeroGPU** - **UI:** fully custom "step into the shade" theme — full-bleed illustrated hero, striped awning, editorial Fraunces headline, IBM Plex Mono kickers, rubber-stamp verdicts, tactile icon tiles and a dawn-to-dusk sun slider; hero + empty-state art generated with Nano Banana (Gemini image gen) - **Fallback:** with no GPU/token the app runs in demo mode (image heuristics) so it works anywhere ## The fine-tune: from "describes skin" to "knows when to worry" The one medically-loaded field — `concern` — is anchored to hard labels, not a bigger model's opinion: ISIC biopsy ground truth + dermatologist-labelled SCIN phone photos. `low` is downsampled and an ABCDE backstop only ever *raises* concern, so the tool can't learn to default to "safe". | metric (141-image held-out test) | base MedGemma | **Chhaya-tuned (v2)** | |---|---|---| | Valid JSON | 99.3% | **100%** | | Concern accuracy | 33.3% | **69.5%** | | Malignant recall | 0.94* | 0.83 | | Output tokens / answer | 770 | **156** | \*Base's recall is hollow — it reaches it by dumping ~60% of cases into "watch" (hence 33% accuracy). The tuned model commits to a real triage and runs 5× shorter. Full field notes: [`writeup/BLOG.md`](writeup/BLOG.md). ## Run locally ```bash pip install -r requirements.txt python app.py # demo mode (no GPU needed) ``` For real MedGemma inference: accept the [Health AI Developer Foundations terms](https://huggingface.co/google/medgemma-1.5-4b-it), then: ```bash export HF_TOKEN=hf_your_token python app.py # auto-loads MedGemma if a CUDA GPU is available ``` `CHHAYA_DEMO=1` forces demo mode. ## Credits & inspiration - [Sunny](https://github.com/mrdbourke/sunny) by Daniel Bourke — a MedGemma skin tracker for Australians that proved this shape of app works. Chhaya reimagines the idea for outdoor workers facing heat waves. - Google's MedGemma team; ISIC for the open lesion archives that make this field possible. ## Safety Chhaya is **not a medical device** and provides no diagnosis. Photos are processed in memory and never stored server-side; records live only in the browser session. Anything that worries you on your skin is, by itself, reason enough to see a clinician.