Histopathology Screener: Free, Private AI Slide Reading with MedGemma

Health Data Lab

A while ago I shared a histopathology screener on LinkedIn: upload a histology image, and an AI model describes it and says whether it looks benign or malignant. It ran on a paid cloud API. I have rebuilt it from scratch, and the headline feature is new: it now runs free, on your own computer, with MedGemma, Google's open medical AI model. No API key, no per-image cost, and the slide never leaves your machine.

Run it free with MedGemma Online demo (Claude & Gemini) Code

For research and medical education only. Not a medical device, and not a diagnosis.

MedGemma: an open medical model on your laptop

MedGemma is a family of open models from Google, built on Gemma 3 and trained further on medical text and images, histopathology among them. The 4-billion-parameter version reads images, and at about 3.3 GB it fits on an ordinary laptop. The app runs it through Ollama, a free tool for running open models locally.

No API key, no billEvery analysis is free, as many as you like.
Private by designThe image is processed on your computer and is never uploaded anywhere.
Works offlineOnce the model is downloaded, no internet connection is needed.
Same reportMedGemma fills in the same structured report as the large cloud models.

Screen mode with MedGemma running locally: the slide stage on the left, the structured AI report on the right

Figure 1: Screen mode with MedGemma running locally: the slide stage on the left, the structured AI report on the right

Every reader, local or cloud, gets the same instructions and fills in the same report: benign, malignant or indeterminate with a confidence score, the specimen and image quality, morphological features (each marked as favouring benign or malignant), a differential diagnosis, teaching points, next steps, and the limits of what one image can show.

The online demo runs on a small free server, which cannot hold a medical model in memory, so MedGemma is only offered when you run the app on your own computer. Online you can use Claude or Gemini with your own key (below).

Run it on your computer in four steps

  1. Install Ollama from ollama.com/download (Windows, macOS or Linux).
  2. Download MedGemma (about 3.3 GB, once):
    ollama pull medgemma:4b
  3. Get the app (Python 3.10 or newer):
    git clone https://github.com/AbdulrahamanMusa/Health-Data-Lab.git
    cd Health-Data-Lab/histo-screener
    pip install -r requirements.txt
  4. Start it and open the address it prints (usually http://127.0.0.1:8000):
    python -m shiny run app.py

The API keys panel: MedGemma shows as Ready when Ollama has the model; until then it shows these setup steps

Figure 2: The API keys panel: MedGemma shows as Ready when Ollama has the model; until then it shows these setup steps

The app checks for MedGemma every 15 seconds, so it unlocks by itself as soon as the download finishes. Choose it from the Read with menu.

The Read with menu: MedGemma alongside Claude and Gemini. Models that need a key stay locked until you add one

Figure 3: The Read with menu: MedGemma alongside Claude and Gemini. Models that need a key stay locked until you add one

How well does a small local model do?

I ran MedGemma 4B on 4 of the app's teaching slides from Wikimedia Commons, each with a known reference diagnosis, on a laptop without a graphics card:

Slide (reference diagnosis)ReferenceMedGemma saidConfidenceResult
Fibroadenoma of the breastBenignMalignant95%Disagrees
Submucosal lipomaBenignIndeterminate60%Didn't commit
Uterine leiomyoma (palisading pattern)BenignMalignant95%Disagrees
Invasive squamous cell carcinomaMalignantIndeterminate60%Didn't commit

0 of 4 matched the reference, 2 disagreed, and 2 were left indeterminate. Each report took 3.9–5.3 minutes (median 4.2) on the CPU; a graphics card brings that down to seconds.

The clearest miss: a Fibroadenoma of the breast, which is benign, was called malignant with 95% confidence. That is the most important lesson of this project. A model can be confidently wrong, which is why the app checks every teaching-slide answer against the reference diagnosis and lets you put two models side by side.

Every answer on a teaching slide is checked against the reference diagnosis, so a wrong call is flagged in plain sight

Figure 4: Every answer on a teaching slide is checked against the reference diagnosis, so a wrong call is flagged in plain sight
The honest summary: MedGemma 4B is a good free, private tool for learning how an AI reads a slide and for discussing features with students. It is not as reliable as the large cloud models, and no model here replaces a pathologist. A handful of slides is a demonstration, not a validation study.

Or use Claude or Gemini with your own key

For stronger answers, the same app works with the large cloud models: Claude (Anthropic) and Gemini (Google). Paste your own API key in the API keys panel and press Test to check it. The key is used only for your session: it is not stored on the server or written to logs, and the page only ever shows its last four characters. Tick Remember on this device to keep it in your browser.

Compare models runs two readers on the same slide, for example MedGemma and Claude. Agreement builds confidence; disagreement shows exactly where a human expert should look.

Learn mode

Learn mode: decide benign or malignant yourself, see the reference diagnosis, then ask the AI to explain

Figure 5: Learn mode: decide benign or malignant yourself, see the reference diagnosis, then ask the AI to explain

Learn mode is a quiz for students: study a teaching slide, zoom in on the nuclei, decide benign or malignant, and see the reference diagnosis with a running score. Then ask the model to explain what it sees. A feature atlas sums up the clues pathologists weigh: circumscription, architecture, nuclear pleomorphism, the nucleus-to-cytoplasm ratio, mitoses, necrosis and invasion.

Built for safe use

Please don't upload images that carry patient names, numbers or other identifiers.

Run it free with MedGemma Online demo (Claude & Gemini) Code

For research and medical education only. Not a medical device, and not a diagnosis.

Teaching slides: Mikael Häggström, M.D. (CC0); Ed Uthman (CC BY 2.0); CoRus13 (CC BY-SA 4.0), via Wikimedia Commons. MedGemma is provided by Google under the Health AI Developer Foundations terms.