akkasayaz commited on
Commit
4683498
1 Parent(s): 3a1e756

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -1,21 +1,26 @@
1
- __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
2
 
 
3
 
 
4
  from fastai.vision.all import *
5
  import gradio as gr
 
6
 
7
-
8
  learn = load_learner('model.pkl')
9
 
 
10
  categories = learn.dls.vocab
11
 
12
  def classify_image(img):
13
- pred, idx, probs =learn.predict(img)
14
- return dict(zip(categories, map(float, probs)))
15
-
16
 
17
- image = gr.inputs.Image(shape=(192,192))
 
18
  label = gr.outputs.Label()
 
19
 
20
- intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
 
21
  intf.launch()
 
 
1
 
2
+ __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
3
 
4
+ # Cell
5
  from fastai.vision.all import *
6
  import gradio as gr
7
+ import timm
8
 
9
+ # Cell
10
  learn = load_learner('model.pkl')
11
 
12
+ # Cell
13
  categories = learn.dls.vocab
14
 
15
  def classify_image(img):
16
+ pred,idx,probs = learn.predict(img)
17
+ return dict(zip(categories, map(float,probs)))
 
18
 
19
+ # Cell
20
+ image = gr.inputs.Image(shape=(192, 192))
21
  label = gr.outputs.Label()
22
+ examples = ['basset.jpg']
23
 
24
+ # Cell
25
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
26
  intf.launch()