Analyze whole slide digital pathology images with the MedGemma 1.5 model via a Streamlit web app. Runs on Apple Silicon using MLX.
Disclaimer: Educational tool only. Not intended for medical diagnosis or treatment.
- Python 3.12+
- Apple Silicon Mac (M1 or later)
- Hugging Face account with access to
google/medgemma-1.5-4b-it
Install dependencies:
uv syncCreate a .env file with your Hugging Face token:
HF_TOKEN=hf_your_token_here
Start the app:
uv run streamlit run streamlit_app.py- Upload a pathology image (PNG, JPEG, or TIFF).
- Adjust patch size and max patches in the sidebar.
- Click Analyze with MedGemma to run inference.
- The uploaded image is split into non-overlapping patches (default 896px).
- Background patches are filtered out.
- Tissue patches are encoded and sent to MedGemma for analysis.
- The model returns a descriptive summary of the tissue.
Run all tests:
uv run pytest