murphybrendan commited on
Commit
188da1d
·
1 Parent(s): 128e759

added the part that actually loads the model

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -1,5 +1,17 @@
1
 
2
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  title = "Bear Classifier"
5
  description = "A classifier that differentiates between grizzly, black, and teddy bears."
 
1
 
2
  import gradio as gr
3
+ from fastai.vision.all import *
4
+ import skimage
5
+
6
+
7
+ learn = load_learner('export.pkl')
8
+
9
+ labels = learn.dls.vocab
10
+ def predict(img):
11
+ img = PILImage.create(img)
12
+ pred,pred_idx,probs = learn.predict(img)
13
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
14
+
15
 
16
  title = "Bear Classifier"
17
  description = "A classifier that differentiates between grizzly, black, and teddy bears."