app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,20 @@
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def is_teddy(x): return x[0].isupper()
|
5 |
-
|
6 |
# Cell
|
7 |
-
learn = load_learner('model.
|
8 |
|
9 |
# Cell
|
10 |
-
categories =
|
11 |
|
12 |
def classify_image(img):
|
13 |
-
pred,idx,probs = learn.
|
14 |
return dict(zip(categories, map(float, probs) ))
|
15 |
|
16 |
# Cell
|
17 |
-
image = gr.
|
18 |
-
label = gr.
|
19 |
-
examples = ['teddy.webp', 'grizzly.jpg', 'black.webp']
|
20 |
|
21 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
22 |
intf.launch(inline=False)
|
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
|
|
|
|
4 |
# Cell
|
5 |
+
learn = load_learner('model.pkl')
|
6 |
|
7 |
# Cell
|
8 |
+
categories = learn.dls.vocab
|
9 |
|
10 |
def classify_image(img):
|
11 |
+
pred,idx,probs = learn.predict(img)
|
12 |
return dict(zip(categories, map(float, probs) ))
|
13 |
|
14 |
# Cell
|
15 |
+
image = gr.components.Image()
|
16 |
+
label = gr.components.Label()
|
17 |
+
examples = ['teddy.webp', 'grizzly.jpg', 'black.webp', 'polar.jpg']
|
18 |
|
19 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
20 |
intf.launch(inline=False)
|
model.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e14c5d86dd7855ee29ea8706c75b6043e6bd500dae4b653660255871cdf413a7
|
3 |
+
size 46968077
|
polar.jpg
ADDED
teddy.webp
CHANGED