Spaces:
Sleeping
Sleeping
Chizoba Obasi
commited on
Commit
·
69e9bba
1
Parent(s):
2deaddb
clean up folder
Browse files- .DS_Store +0 -0
- app.ipynb +1 -1
- app/app.py +0 -29
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
app.ipynb
CHANGED
@@ -681,7 +681,7 @@
|
|
681 |
},
|
682 |
{
|
683 |
"cell_type": "code",
|
684 |
-
"execution_count":
|
685 |
"id": "3debd079",
|
686 |
"metadata": {},
|
687 |
"outputs": [],
|
|
|
681 |
},
|
682 |
{
|
683 |
"cell_type": "code",
|
684 |
+
"execution_count": 29,
|
685 |
"id": "3debd079",
|
686 |
"metadata": {},
|
687 |
"outputs": [],
|
app/app.py
DELETED
@@ -1,29 +0,0 @@
|
|
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 3
|
7 |
-
from fastai.vision.all import *
|
8 |
-
import gradio as gr
|
9 |
-
|
10 |
-
def is_cat(x):
|
11 |
-
return x[0].isupper()
|
12 |
-
|
13 |
-
# %% ../app.ipynb 5
|
14 |
-
learn = load_learner('model.pkl')
|
15 |
-
|
16 |
-
# %% ../app.ipynb 7
|
17 |
-
categories = ('Dog', 'Cat')
|
18 |
-
|
19 |
-
def classify_image(img):
|
20 |
-
pred, idx, probs = learn.predict(img)
|
21 |
-
return dict(zip(categories, map(float, probs)))
|
22 |
-
|
23 |
-
# %% ../app.ipynb 9
|
24 |
-
image = gr.Image(shape=(192, 192))
|
25 |
-
label = gr.Label()
|
26 |
-
examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']
|
27 |
-
|
28 |
-
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
29 |
-
intf.launch(inline=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|