Run this model with HF Jobs
Run NeuronZero/MRI-Reader on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/NeuronZero/MRI-Reader. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/NeuronZero/MRI-Reader on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use NeuronZero/MRI-Reader with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NeuronZero/MRI-Reader with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="NeuronZero/MRI-Reader") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("NeuronZero/MRI-Reader") model = AutoModelForImageClassification.from_pretrained("NeuronZero/MRI-Reader", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files25 unmodified lines262728293031323334353637383940414243444546474825 unmodified lines### How to useHere is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:```pythonfrom transformers import AutoImageProcessor, SwinForImageClassificationfrom PIL import Imageimport requestsurl = "http://images.cocodataset.org/val2017/000000039769.jpg"image = Image.open(requests.get(url, stream=True).raw)processor = AutoImageProcessor.from_pretrained("microsoft/swin-base-patch4-window7-224-in22k")model = SwinForImageClassification.from_pretrained("microsoft/swin-base-patch4-window7-224-in22k")inputs = processor(images=image, return_tensors="pt")outputs = model(**inputs)logits = outputs.logits# model predicts one of the 1000 ImageNet classespredicted_class_idx = logits.argmax(-1).item()print("Predicted class:", model.config.id2label[predicted_class_idx])```25 unmodified lines26272829303132333435363738394041424344454647484925 unmodified lines### How to useHere is how to use this model to identify meningioma tumor from a MRI scan:```pythonfrom transformers import AutoImageProcessor, AutoModelForImageClassificationfrom PIL import Imageimport requestsprocessor = AutoImageProcessor.from_pretrained("NeuronZero/MRI-Reader")model = AutoModelForImageClassification.from_pretrained("NeuronZero/MRI-Reader")# Dataset url: https://www.kaggle.com/datasets/sartajbhuvaji/brain-tumor-classification-mriimage_url = "https://storage.googleapis.com/kagglesdsdata/datasets/672377/1183165/Testing/meningioma_tumor/image%28112%29.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=databundle-worker-v2%40kaggle-161607.iam.gserviceaccount.com%2F20240326%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20240326T125018Z&X-Goog-Expires=345600&X-Goog-SignedHeaders=host&X-Goog-Signature=32461d8d00888de5030d0dac653ecf5301c79a9445320a29c515713611fc8ec5bd6de1f1be490041f0dd937d7165f2bd3176ca926f2f33787a6ca7dbae1db2ce0b3a482a27a6258d4fe64c92ef7004c81488bfede784e50f22742e214cc303e8e9a52c6b4bc1db20e8aafba80589e87028e2f3212436c45fd7bc0a6978af3c2a2a5cbc25dcddf1489aecacaeebc75b93b2e111d391cf82c50a38906f88eec30e928285f043527972eed6d0dd2cd53b7e61c1be82bbefd6f8f38ffe438155e0dcf386425693a61c8c5857d6f4dbea7a8351e496160da261778c5f26d5496243f863ca65caf2b630701a998e79ce0bfa32291b19410a0f72d3399cea86b695c7dd"image = Image.open(requests.get(image_url, stream=True).raw)inputs = processor(images=image, return_tensors="pt")outputs = model(**inputs)logits = outputs.logitspredicted_class_idx = logits.argmax(-1).item()print("Predicted class:", model.config.id2label[predicted_class_idx])```
README.md+8-7