Spaces:
Sleeping
Sleeping
Commit
·
02a75c6
1
Parent(s):
89e5f67
Removing minima
Browse files- minima/app.py +0 -26
minima/app.py
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
-
|
3 |
-
# %% auto 0
|
4 |
-
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
-
|
6 |
-
# %% ../app.ipynb 1
|
7 |
-
from fastai.vision.all import *
|
8 |
-
import gradio as gr
|
9 |
-
|
10 |
-
# %% ../app.ipynb 3
|
11 |
-
learn = load_learner('export.pkl')
|
12 |
-
|
13 |
-
# %% ../app.ipynb 5
|
14 |
-
categories = ('grizzly', 'black', 'teddy')
|
15 |
-
|
16 |
-
def classify_image(im):
|
17 |
-
pred, idx, probs = learn.predict(im)
|
18 |
-
return dict(zip(categories, map(float, probs)))
|
19 |
-
|
20 |
-
# %% ../app.ipynb 7
|
21 |
-
image = gr.Image(width=192, height=192)
|
22 |
-
label = gr.Label()
|
23 |
-
examples = ['grizzly.jpg', 'black.jpg', 'teddy.jpg', 'dunno.jpg']
|
24 |
-
|
25 |
-
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
26 |
-
intf.launch(inline=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|