Spaces:
Runtime error
Runtime error
Parker Moesta
commited on
Commit
·
7fddb45
1
Parent(s):
739cddd
update app.py
Browse files
app.py
CHANGED
@@ -8,12 +8,14 @@ learn = load_learner('model.pkl')
|
|
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 |
-
|
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 |
-
|
|
|
|
|
|
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 |
+
|
20 |
+
if __name__ == '__main__':
|
21 |
+
intf.launch()
|