Add app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,18 @@
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
learn = load_learner('cats.pkl')
|
8 |
|
9 |
-
# %% app.ipynb
|
10 |
categories = ('Dog', 'Cat')
|
11 |
|
12 |
def classify_image(img):
|
@@ -14,6 +20,9 @@ def classify_image(img):
|
|
14 |
return dict(zip(categories, map(float, probs)))
|
15 |
|
16 |
# %% app.ipynb 8
|
|
|
|
|
|
|
17 |
image = Image(shape=(192,192))
|
18 |
label = Label()
|
19 |
examples = ['dog.jpeg', 'cat.jpeg', 'lemon.jpg']
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
|
5 |
|
6 |
+
# %% app.ipynb 2
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
def is_cat(x): return x[0].isupper()
|
11 |
+
|
12 |
+
# %% app.ipynb 4
|
13 |
learn = load_learner('cats.pkl')
|
14 |
|
15 |
+
# %% app.ipynb 6
|
16 |
categories = ('Dog', 'Cat')
|
17 |
|
18 |
def classify_image(img):
|
|
|
20 |
return dict(zip(categories, map(float, probs)))
|
21 |
|
22 |
# %% app.ipynb 8
|
23 |
+
from gradio.components import Image, Label
|
24 |
+
|
25 |
+
# %% app.ipynb 9
|
26 |
image = Image(shape=(192,192))
|
27 |
label = Label()
|
28 |
examples = ['dog.jpeg', 'cat.jpeg', 'lemon.jpg']
|