sskenner commited on
Commit
907e6d8
·
1 Parent(s): 3325eb5

update .gitattributes so git lfs will track .pkl files

Browse files
Files changed (4) hide show
  1. app.py +27 -0
  2. bears_identifier_final.pkl +3 -0
  3. grizzly.jpg +3 -0
  4. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('bears_identifier_final.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 = "Bear Classifier"
14
+ description = "A bear classifier trained on DDG images with Fastai. Created as demo for Gradio and HuggingFace Spaces."
15
+ article="<p style='text-align: center'><a href='#' target='_blank'>TBD</a></p>"
16
+ examples = ['grizzly.jpg']
17
+ interpretation='default'
18
+ enable_queue=True
19
+
20
+ gr.Interface(
21
+ fn=predict,
22
+ inputs=gr.Image(),
23
+ outputs=gr.Label(num_top_classes=3),
24
+ title=title,
25
+ description=description,
26
+ article=article,
27
+ examples=examples,).launch(share=True)
bears_identifier_final.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d61f8fdc84c322f5e46d46368f602d612b3406968c88727b005bde6b62cbf6b
3
+ size 46973822
grizzly.jpg ADDED

Git LFS Details

  • SHA256: 2f12ed680dca7a5ccd0e9c9522365c7374a154c69ffa2b19f32723f45499f1ac
  • Pointer size: 131 Bytes
  • Size of remote file: 698 kB
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image