gzcui163 commited on
Commit
1288394
·
verified ·
1 Parent(s): 79e006a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -1,18 +1,18 @@
1
- from fastai.vision.all import *
2
- import gradio as gr
3
-
4
- learn = load_learner('model.pkl')
5
- labels = learn.dls.vocab
6
- def predict(img):
7
- img = PILImage.create(img)
8
- pred,pred_idx,probs = learn.predict(img)
9
- return dict(zip(labels, map(float, probs)))
10
-
11
- title = "Lion Tiger Classifier"
12
- examples = ['lion.jpg', 'tiger.jpg', 'tigon.jpg', 'liger']
13
- demo = gr.Interface(fn=predict,
14
- inputs=gr.Image('lion.jpg'),
15
- outputs=gr.Label(),
16
- title=title,
17
- examples=examples)
18
- demo.launch(inline=False, show_error=True)
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('model.pkl')
5
+ labels = learn.dls.vocab
6
+ def predict(img):
7
+ img = PILImage.create(img)
8
+ pred,pred_idx,probs = learn.predict(img)
9
+ return dict(zip(labels, map(float, probs)))
10
+
11
+ title = "Lion Tiger Classifier"
12
+ examples = ['lion.jpg', 'tiger.jpg', 'tigon.jpg', 'liger.jpg']
13
+ demo = gr.Interface(fn=predict,
14
+ inputs=gr.Image('lion.jpg'),
15
+ outputs=gr.Label(),
16
+ title=title,
17
+ examples=examples)
18
+ demo.launch(inline=False, show_error=True)