Edit model card

from transformers import AutoImageProcessor, SwinForImageClassification

from PIL import Image

import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"

image = Image.open(requests.get(url, stream=True).raw)

processor = AutoImageProcessor.from_pretrained("alicelouis/Swin2e-4Lion")

model = SwinForImageClassification.from_pretrained("alicelouis/Swin2e-4Lion")

inputs = processor(images=image, return_tensors="pt")

outputs = model(**inputs)

logits = outputs.logits

model predicts one of the 1000 ImageNet classes

predicted_class_idx = logits.argmax(-1).item()

print("Predicted class:", model.config.id2label[predicted_class_idx])

Downloads last month
11
Safetensors
Model size
86.8M params
Tensor type
I64
·
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.