Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Stanford-AIMI/CheXagent
[Arxiv-2024] CheXagent: Towards a Foundation Model for Chest X-Ray Interpretation
https://github.com/Stanford-AIMI/CheXagent
Last synced: 20 days ago
JSON representation
[Arxiv-2024] CheXagent: Towards a Foundation Model for Chest X-Ray Interpretation
- Host: GitHub
- URL: https://github.com/Stanford-AIMI/CheXagent
- Owner: Stanford-AIMI
- Created: 2023-12-14T17:44:21.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-07T01:01:40.000Z (9 months ago)
- Last Synced: 2024-08-01T02:26:43.057Z (4 months ago)
- Language: Python
- Homepage: https://stanford-aimi.github.io/chexagent.html
- Size: 4.88 KB
- Stars: 104
- Watchers: 6
- Forks: 7
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CheXagent
📝 Paper • 🤗 Hugging Face • 🧩 Github • 🪄 Project## ✨ Latest News
- [12/15/2023]: Model released in [Hugging Face](https://huggingface.co/StanfordAIMI/CheXagent-8b/).
## 🎬 Get Started
```python
import ioimport requests
import torch
from PIL import Image
from transformers import AutoModelForCausalLM, AutoProcessor, GenerationConfig# step 1: Setup constant
device = "cuda"
dtype = torch.float16# step 2: Load Processor and Model
processor = AutoProcessor.from_pretrained("StanfordAIMI/CheXagent-8b", trust_remote_code=True)
generation_config = GenerationConfig.from_pretrained("StanfordAIMI/CheXagent-8b")
model = AutoModelForCausalLM.from_pretrained("StanfordAIMI/CheXagent-8b", torch_dtype=dtype, trust_remote_code=True)# step 3: Fetch the images
image_path = "https://upload.wikimedia.org/wikipedia/commons/3/3b/Pleural_effusion-Metastatic_breast_carcinoma_Case_166_%285477628658%29.jpg"
images = [Image.open(io.BytesIO(requests.get(image_path).content)).convert("RGB")]# step 4: Generate the Findings section
prompt = f'Describe "Airway"'
inputs = processor(images=images, text=f" USER: {prompt} ASSISTANT: ", return_tensors="pt").to(device=device, dtype=dtype)
output = model.generate(**inputs, generation_config=generation_config)[0]
response = processor.tokenizer.decode(output, skip_special_tokens=True)
```## ✏️ Citation
```
@article{chexagent-2024,
title={CheXagent: Towards a Foundation Model for Chest X-Ray Interpretation},
author={Chen, Zhihong and Varma, Maya and Delbrouck, Jean-Benoit and Paschali, Magdalini and Blankemeier, Louis and Veen, Dave Van and Valanarasu, Jeya Maria Jose and Youssef, Alaa and Cohen, Joseph Paul and Reis, Eduardo Pontes and Tsai, Emily B. and Johnston, Andrew and Olsen, Cameron and Abraham, Tanishq Mathew and Gatidis, Sergios and Chaudhari, Akshay S and Langlotz, Curtis},
journal={arXiv preprint arXiv:2401.12208},
url={https://arxiv.org/abs/2401.12208},
year={2024}
}
```