Spaces:
Runtime error
Runtime error
Parker Moesta
commited on
Commit
·
341964e
1
Parent(s):
8cf2d92
Delete bear_class.py
Browse files- bear_class.py/app.py +0 -19
bear_class.py/app.py
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
from fastai.vision.all import *
|
2 |
-
import gradio as gr
|
3 |
-
|
4 |
-
#|export
|
5 |
-
learn = load_learner('model.pkl')
|
6 |
-
|
7 |
-
#|export
|
8 |
-
categories = learn.dls.vocab
|
9 |
-
|
10 |
-
def classify_image(inp):
|
11 |
-
pred,pred_idx,probs = learn.predict(inp)
|
12 |
-
return dict(zip(categories, map(float, probs)))
|
13 |
-
|
14 |
-
image = gr.inputs.Image(shape=(128,128))
|
15 |
-
label = gr.outputs.Label(num_top_classes=3)
|
16 |
-
examples = ['teddy_1.jpg', 'grizzly_1.jpg','black_bear.jpg']
|
17 |
-
|
18 |
-
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title='Bear Classifier', description='An AI that identifies bears')
|
19 |
-
intf.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|