Spaces:
Sleeping
Sleeping
Delete README.md
Browse files
README.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Chest X-ray Recommender
|
| 3 |
-
emoji: 🩻
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: blue
|
| 6 |
-
sdk: gradio
|
| 7 |
-
app_file: app.py
|
| 8 |
-
pinned: false
|
| 9 |
-
license: mit
|
| 10 |
-
python_version: 3.10.13
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# Chest X-ray Recommender
|
| 14 |
-
|
| 15 |
-
A visual recommendation engine for chest X-rays, built with CLIP embeddings
|
| 16 |
-
and Gradio. Upload an X-ray **or** describe a finding in words and the app
|
| 17 |
-
returns the 3 most visually similar studies from a pre-computed catalog
|
| 18 |
-
drawn from [`MLforHealthcare/mimic-cxr`](https://huggingface.co/datasets/MLforHealthcare/mimic-cxr).
|
| 19 |
-
|
| 20 |
-
> Educational demo only. **Not** a medical device. Do not use for clinical
|
| 21 |
-
> decisions.
|
| 22 |
-
|
| 23 |
-
## How it works
|
| 24 |
-
|
| 25 |
-
1. The companion notebook (`Assignment_3_MIMIC_CXR_Recommender.ipynb`)
|
| 26 |
-
subsamples 2,000 chest X-rays from the dataset.
|
| 27 |
-
2. Each image is embedded with
|
| 28 |
-
[`openai/clip-vit-base-patch32`](https://huggingface.co/openai/clip-vit-base-patch32)
|
| 29 |
-
into a 512-dimensional vector and L2-normalised.
|
| 30 |
-
3. The embeddings, base64-encoded thumbnails, and matching radiology
|
| 31 |
-
reports are saved together to `embeddings.parquet`.
|
| 32 |
-
4. This Space loads that parquet on startup. At query time, the user's
|
| 33 |
-
text or image is embedded with the same CLIP model and we return the
|
| 34 |
-
top-3 catalog items by cosine similarity.
|
| 35 |
-
|
| 36 |
-
## Files in this Space
|
| 37 |
-
|
| 38 |
-
| File | Purpose |
|
| 39 |
-
|------------------------|---------|
|
| 40 |
-
| `app.py` | Gradio interface + recommendation logic |
|
| 41 |
-
| `requirements.txt` | Python dependencies |
|
| 42 |
-
| `embeddings.parquet` | Pre-computed catalog (built by the notebook) |
|
| 43 |
-
| `README.md` | This file (also drives the Space card) |
|
| 44 |
-
|
| 45 |
-
## Running locally
|
| 46 |
-
|
| 47 |
-
```bash
|
| 48 |
-
pip install -r requirements.txt
|
| 49 |
-
python app.py
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
The app launches at <http://127.0.0.1:7860>.
|
| 53 |
-
|
| 54 |
-
## Configuration
|
| 55 |
-
|
| 56 |
-
A few environment variables tweak the behaviour:
|
| 57 |
-
|
| 58 |
-
| Variable | Default | Description |
|
| 59 |
-
|-------------------|------------------------------------|-------------|
|
| 60 |
-
| `CLIP_MODEL_ID` | `openai/clip-vit-base-patch32` | Any HF CLIP model, e.g. `flaviagiammarino/pubmed-clip-vit-base-patch32` for medical fine-tuning. |
|
| 61 |
-
| `EMBEDDINGS_FILE` | `embeddings.parquet` | Path to the catalog file. |
|
| 62 |
-
| `VIDEO_EMBED_ID` | (empty) | YouTube video id for the walk-through. When set, the Space adds an embed at the bottom of the page. |
|
| 63 |
-
|
| 64 |
-
## Acknowledgements
|
| 65 |
-
|
| 66 |
-
- Dataset: [MLforHealthcare/mimic-cxr](https://huggingface.co/datasets/MLforHealthcare/mimic-cxr)
|
| 67 |
-
- Embedding model: [openai/clip-vit-base-patch32](https://huggingface.co/openai/clip-vit-base-patch32)
|
| 68 |
-
- Course: Data Science Assignment 3 - Embeddings, RecSys, Spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|