mrosinski commited on
Commit
1430324
1 Parent(s): 572fd72

let's deploy to huggingface spaces

Browse files
Files changed (6) hide show
  1. .DS_Store +0 -0
  2. app.py +20 -0
  3. pets_model.pkl +3 -0
  4. ragdoll.jpg +3 -0
  5. requirements.txt +2 -0
  6. setup.txt +8 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('pets_model.pkl')
6
+
7
+ labels = learn.dls.vocab
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predict(img)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ title = "Pet Breed Classifier"
14
+ description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
15
+ article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
16
+ examples = ['ragdoll.jpg']
17
+ interpretation='default'
18
+ enable_queue=True
19
+
20
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
pets_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8d040870618c05b665d246ccdb4bc074577b960418b7a082cd36fdfb8581947
3
+ size 103045973
ragdoll.jpg ADDED

Git LFS Details

  • SHA256: 681d21c7c1969943728d563d18ec8719899ef1e90fb2e096ab20c909e9dbc796
  • Pointer size: 132 Bytes
  • Size of remote file: 1.06 MB
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image
setup.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Run the following commands in the terminal to enable large file storage
2
+ git lfs install
3
+ # or
4
+ brew install git-lfs
5
+ # then in the git folder you want to use git-lfs
6
+ git lfs track "*.pkl"
7
+
8
+ git add .gitattributes