Delete app.py
Browse files
app.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
-
|
3 |
-
# %% auto 0
|
4 |
-
__all__ = ['learn', 'options', 'image', 'label', 'examples', 'intf', 'whichBear', 'classify_img']
|
5 |
-
|
6 |
-
# %% app.ipynb 2
|
7 |
-
from fastai.vision.all import *
|
8 |
-
import gradio as gr
|
9 |
-
|
10 |
-
|
11 |
-
def whichBear(x): return x[0].isBear()
|
12 |
-
|
13 |
-
# %% app.ipynb 4
|
14 |
-
learn = load_learner('model.pkl')
|
15 |
-
|
16 |
-
|
17 |
-
# %% app.ipynb 6
|
18 |
-
options = ("grizzly", "black", "teddy")
|
19 |
-
|
20 |
-
def classify_img(img):
|
21 |
-
pred,idx,probs = learn.predict(img)
|
22 |
-
return dict(zip(options, map(float, probs)))
|
23 |
-
|
24 |
-
# %% app.ipynb 8
|
25 |
-
image = gr.Image()
|
26 |
-
label = gr.Label()
|
27 |
-
examples = ["brown_bear.jpg", "grizzly_bear.jpg", "teddy_bear.jpg"]
|
28 |
-
|
29 |
-
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
|
30 |
-
intf.launch(inline=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|