rsadaphule commited on
Commit
150c277
1 Parent(s): b01a03d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -33
README.md CHANGED
@@ -18,42 +18,12 @@ This model is a fine-tuned version of [google/vit-base-patch16-224](https://hugg
18
 
19
  ## Model description
20
 
21
- Sample code
22
- import torch
23
- from transformers import AutoModelForImageClassification, AutoFeatureExtractor
24
- import gradio as gr
25
-
26
- model_id = f'rsadaphule/vit-base-patch16-224-finetuned-wildcats'
27
- labels = ['AFRICAN LEOPARD',
28
- 'CARACAL',
29
- 'CHEETAH',
30
- 'CLOUDED LEOPARD',
31
- 'JAGUAR',
32
- 'LIONS',
33
- 'OCELOT',
34
- 'PUMA',
35
- 'SNOW LEOPARD',
36
- 'TIGER']
37
-
38
-
39
- def classify_image(image):
40
- model = AutoModelForImageClassification.from_pretrained(model_id)
41
- feature_extractor = AutoFeatureExtractor.from_pretrained(model_id)
42
- inp = feature_extractor(image, return_tensors='pt')
43
- outp = model(**inp)
44
- pred = torch.nn.functional.softmax(outp.logits, dim=-1)
45
- preds = pred[0].cpu().detach().numpy()
46
- confidence = {label: float(preds[i]) for i, label in enumerate(labels)}
47
- return confidence
48
-
49
- interface = gr.Interface(fn=classify_image,
50
- inputs='image',
51
- examples=['cat1.jpg', 'cat2.jpg'],
52
- outputs='label').launch(debug=True, share=True)
53
 
54
  ## Intended uses & limitations
55
 
56
- More information needed
57
 
58
  ## Training and evaluation data
59
 
 
18
 
19
  ## Model description
20
 
21
+ Demo is hosted at https://huggingface.co/spaces/rsadaphule/wildcats
22
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ## Intended uses & limitations
25
 
26
+ Classify wildcats
27
 
28
  ## Training and evaluation data
29