Downloads · 30 days
10
16% of all-time downloads
MedeHealth/medgemma-chest-xray-v2
medgemma-chest-xray-v2 is a image-text-to-text model from MedeHealth. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as gemma.
Fine-tuned google/medgemma-4b-it for Portuguese chest X-ray reports.
Downloads · 30 days
10
16% of all-time downloads
All-time downloads
62
Public
Parameters
5B
10 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors9.9 GB · 100%
From the Hugging Face model README
Fine-tuned google/medgemma-4b-it for Portuguese chest X-ray reports.
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
import torch
model = AutoModelForImageTextToText.from_pretrained("MedeHealth/medgemma-chest-xray-v2", torch_dtype=torch.bfloat16, device_map="auto")
processor = AutoProcessor.from_pretrained("MedeHealth/medgemma-chest-xray-v2")
image = Image.open("chest_xray.png").convert("RGB")
messages = [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "Analise esta radiografia de tórax."}]}]
text = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = processor(text=text, images=[image], return_tensors="pt").to(model.device)
with torch.inference_mode():
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(processor.decode(outputs[0], skip_special_tokens=True))
For research only. Not for clinical use without radiologist review.