Abdul-Haseeb-Shahbaz commited on
Commit
765d291
·
verified ·
1 Parent(s): e64c836

Adding files

Browse files
Files changed (7) hide show
  1. README.md +6 -5
  2. app.py +21 -0
  3. model.pkl +3 -0
  4. model_convnext.pkl +3 -0
  5. ragdoll.jpeg +0 -0
  6. requirements.txt +3 -0
  7. shiba.jpeg +0 -0
README.md CHANGED
@@ -1,12 +1,13 @@
1
  ---
2
- title: Pets Classifier
3
- emoji: 📊
4
- colorFrom: green
5
- colorTo: blue
6
  sdk: gradio
7
- sdk_version: 4.38.1
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Fastai Pet Classifier
3
+ emoji: 🏢
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.29.0
8
  app_file: app.py
9
  pinned: false
10
+ license: apache-2.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ #learn = load_learner('model.pkl')
6
+ learn = load_learner('model_convnext.pkl')
7
+
8
+ labels = learn.dls.vocab
9
+ def predict(img):
10
+ img = PILImage.create(img)
11
+ pred,pred_idx,probs = learn.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ title = "Pet Breed Classifier"
15
+ description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
16
+ examples = ['shiba.jpeg','ragdoll.jpeg']
17
+ #interpretation='default'
18
+ #enable_queue=True
19
+
20
+ gr.Interface(fn=predict,inputs=gr.Image(type="pil"),outputs=gr.Label(num_top_classes=3)
21
+ ,title=title,description=description,examples=examples).launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cee4c6bc7726119e93d954045f4f82caaf60fc7bdf7bcbdc63e6c075af5fc75d
3
+ size 103096018
model_convnext.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c77df2d1288ae5bcfd1292586d7cf734806a86a02b49418d17c017bc7505a26
3
+ size 354985524
ragdoll.jpeg ADDED
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastai
2
+ scikit-image
3
+ timm
shiba.jpeg ADDED