furusu commited on
Commit
80b4a18
1 Parent(s): 2d5b980

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -7,3 +7,22 @@ finetuned from https://huggingface.co/google/vit-base-patch16-224-in21k
7
  dataset:26k images
8
 
9
  accuracy of validation dataset is 95%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  dataset:26k images
8
 
9
  accuracy of validation dataset is 95%
10
+
11
+
12
+ ```Python
13
+ from transformers import ViTFeatureExtractor, ViTForImageClassification
14
+ from PIL import Image
15
+
16
+ path = 'image_path'
17
+ image = Image.open(path)
18
+
19
+ feature_extractor = ViTFeatureExtractor.from_pretrained('furusu/umamusume-classifier')
20
+ model = ViTForImageClassification.from_pretrained('furusu/umamusume-classifier')
21
+ inputs = feature_extractor(images=image, return_tensors="pt")
22
+
23
+ outputs = model(**inputs)
24
+
25
+ predicted_class_idx = outputs.logits.argmax(-1).item()
26
+ print("Predicted class:", model.config.id2label[predicted_class_idx])
27
+
28
+ ```