Skip to content

Repository files navigation

DocGemma

Source repositories: docgemma-connect (FastAPI backend) | docgemma-frontend (Vue 3 UI)

Competition: The MedGemma Impact Challenge on Kaggle

Agentic medical AI assistant powered by MedGemma, with autonomous tool calling for clinical decision support. Designed for resource-limited healthcare environments. Compatible with MedGemma 27B and MedGemma 1.5 4B.

DocGemma combines a Vue 3 web interface with a FastAPI/LangGraph agent backend that can query drug safety databases, search medical literature, manage electronic health records, and analyze medical images — all with human-in-the-loop approval for safety-critical actions.

Live Demo

Open In Colab

Try DocGemma instantly on Google Colab — no local setup required. The notebook provisions an A100 GPU, deploys the full stack (vLLM + backend + frontend), and generates a public URL. Just provide a HuggingFace token with MedGemma access.

Prerequisites

  • Docker and Docker Compose v2+, or Podman with podman compose

For local GPU inference (optional):

For remote inference:

Quick Start

Option 1: Native (No Docker)

For GPU cloud instances (RunPod, Vast.ai, Lambda, Paperspace, AWS/GCP/Azure) or bare metal with an NVIDIA GPU. Installs everything directly on the host — no containers needed.

git clone https://github.com/galinilin/docgemma-app.git
HF_TOKEN=hf_your_token_here bash docgemma-app/run-native.sh

The script auto-detects GPU VRAM (falls back to MedGemma 4B if < 40 GB), installs dependencies (Node.js, UV, vLLM), builds the frontend, and starts vLLM + the app on a single port.

Variable Default Description
HF_TOKEN HuggingFace token (required)
DOCGEMMA_MODEL google/medgemma-27b-it Auto-selected based on VRAM
APP_PORT 8080 Web UI port
VLLM_PORT 8000 vLLM API port
WORKDIR /workspace/docgemma Clone/build directory

Option 2: Docker — Remote Endpoint (No GPU Required)

git clone https://github.com/galinilin/docgemma-app.git
cd docgemma-app
cp .env.example .env

Edit .env and set your endpoint credentials:

DOCGEMMA_ENDPOINT=https://your-vllm-endpoint.example.com
DOCGEMMA_API_KEY=your-api-key-here
docker compose --profile remote up

Option 3: Docker — Local GPU with vLLM

git clone https://github.com/galinilin/docgemma-app.git
cd docgemma-app
cp .env.example .env

Edit .env and set your HuggingFace token:

HF_TOKEN=hf_your_token_here
docker compose --profile gpu up

Note: The first run downloads model weights (~54 GB for MedGemma 27B, ~8 GB for MedGemma 1.5 4B). The vLLM health check allows up to 10 minutes for the model to load.

Podman

Both profiles work with Podman. For the remote profile, use the default compose file:

podman compose --profile remote up

For the gpu profile, use the Podman-specific compose file (uses CDI instead of Docker's deploy.resources for GPU passthrough):

podman compose -f docker-compose.podman.yml --profile gpu up

Requires NVIDIA Container Toolkit with CDI configured for Podman.


Open http://localhost:8080 in your browser.

Architecture

Browser ──→ Vue 3 SPA ──→ FastAPI + LangGraph Agent ──→ vLLM / MedGemma
                │                    │
                │                    ├── Drug safety (OpenFDA)
                │                    ├── Drug interactions (RxNav)
                │                    ├── Medical literature (PubMed)
                │                    ├── Clinical trials (ClinicalTrials.gov)
                │                    ├── FHIR R4 EHR (local store)
                │                    └── Medical image analysis (vision API)
                │
                └── Patient management, imaging upload, clinical notes

The Docker image bundles everything into a single container:

  • Frontend: Vue 3 + TypeScript + Tailwind CSS, built and served as static files
  • Backend: Python/FastAPI with a 7-node LangGraph agent workflow
  • Model: MedGemma 27B or 1.5 4B via vLLM (OpenAI-compatible API)

Configuration

Variable Required Default Description
DOCGEMMA_ENDPOINT remote profile vLLM endpoint URL
DOCGEMMA_API_KEY remote profile API key for the endpoint
HF_TOKEN gpu profile HuggingFace token (with MedGemma access)
DOCGEMMA_MODEL no google/medgemma-27b-it Model ID — also supports google/medgemma-1.5-4b-it
DOCGEMMA_PORT no 8080 Host port for the web UI
VLLM_MAX_MODEL_LEN no 8192 Maximum context length
VLLM_GPU_UTIL no 0.90 GPU memory utilization (0.0–1.0)

Data Persistence

Patient records (FHIR R4) and chat session history are stored in a Docker volume (docgemma-data). On first run, sample patient records are seeded automatically.

To reset all data to defaults:

docker compose down -v

Building with Specific Versions

Pin the backend and frontend to specific branches or tags:

docker compose build \
  --build-arg BACKEND_REF=v1.0.0 \
  --build-arg FRONTEND_REF=v1.0.0

Available build args:

Arg Default Description
BACKEND_REPO https://github.com/galinilin/docgemma-connect.git Backend repo URL
BACKEND_REF main Branch, tag, or commit
FRONTEND_REPO https://github.com/galinilin/docgemma-frontend.git Frontend repo URL
FRONTEND_REF main Branch, tag, or commit

Development

For development, clone the source repositories directly:

Troubleshooting

vLLM takes a long time to start First run downloads model weights (~54 GB for MedGemma 27B, ~8 GB for MedGemma 1.5 4B). Subsequent runs use the cached weights in the vllm-cache Docker volume.

GPU out of memory Reduce VLLM_GPU_UTIL (e.g., 0.80) or VLLM_MAX_MODEL_LEN (e.g., 4096) in your .env.

Connection refused on remote profile Verify DOCGEMMA_ENDPOINT is reachable and includes the correct port (e.g., https://host:8000).

Rebuilding after source updates Force a fresh build to pull latest source code:

docker compose build --no-cache

Related Repositories

Repository Description
docgemma-connect FastAPI backend with LangGraph agent, FHIR R4 EHR, and medical tool integrations
docgemma-frontend Vue 3 web interface with real-time chat, EHR management, and tool approval UI

Disclaimer

DocGemma is a research and educational tool. It is not certified for clinical use. Do not use for real patient care decisions.

About

Deploy DocGemma with one command — or try it instantly on Google Colab. Includes Docker Compose (local GPU + remote endpoint profiles), native GPU runner, and a Colab notebook with live demo via public URL.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages