yachtsman commited on
Commit
2205121
·
1 Parent(s): f2ce440

let's deploy to huggingface spaces

Browse files
Files changed (4) hide show
  1. app.py +22 -0
  2. export.pkl +3 -0
  3. grizzly.jpg +0 -0
  4. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('export.pkl')
5
+ labels = learn.dls.vocab
6
+
7
+ def predict(img):
8
+ img = PILImage.create(img)
9
+ pred,pred_idx,probs = learn.predict(img)
10
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
+
12
+ title = "Bears Classifier"
13
+ description = "A simple bears classifier trained on the dataset created with fastai & bing search."
14
+ examples = ['grizzly.jpg']
15
+
16
+ gr.Interface(fn=predict,
17
+ inputs=gr.Image(shape=(512, 512)),
18
+ outputs=gr.Label(num_top_classes=3),
19
+ title=title,
20
+ description=description,
21
+ examples=examples,
22
+ ).launch(share=True, enable_queue=True)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c854dbacbfaa6d33080db336a6dbacaf0c7af3487212b023f72b267caf6711e0
3
+ size 46967009
grizzly.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai