anewsha commited on
Commit
986d554
·
1 Parent(s): 121bd92

exportscript notebook

Browse files
Files changed (2) hide show
  1. app.py +12 -1
  2. model.pkl +3 -0
app.py CHANGED
@@ -1,14 +1,25 @@
 
 
 
 
 
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
 
 
4
  learn = load_learner("model.pkl")
5
 
 
6
  categories = {'Grizzly bear','black bear','teddy bear'}
7
  def classify_image(img):
8
  pred,idx,probs = learn.predict(img)
9
  return dict(zip(categories, map(float,probs)))
10
 
 
11
  image = gr.inputs.Image(shape=(192, 192))
12
  label = gr.outputs.Label()
13
  Examples = ['teddybear.jpg','blackbear.jpg','grizzlybear.jpg']
14
- gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=Examples).launch()
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../pickerfile.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'Examples', 'classify_image']
5
+
6
+ # %% ../pickerfile.ipynb 3
7
  from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+
11
+ # %% ../pickerfile.ipynb 4
12
  learn = load_learner("model.pkl")
13
 
14
+ # %% ../pickerfile.ipynb 7
15
  categories = {'Grizzly bear','black bear','teddy bear'}
16
  def classify_image(img):
17
  pred,idx,probs = learn.predict(img)
18
  return dict(zip(categories, map(float,probs)))
19
 
20
+ # %% ../pickerfile.ipynb 9
21
  image = gr.inputs.Image(shape=(192, 192))
22
  label = gr.outputs.Label()
23
  Examples = ['teddybear.jpg','blackbear.jpg','grizzlybear.jpg']
24
+ gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=Examples).launch()
25
+
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:461ac51609613b74fbae582c296517120776dbc1b1734605f0bf2883f3011521
3
+ size 46964778