Spaces:
Sleeping
Sleeping
Donald Kapyouo
commited on
Commit
·
68b3403
1
Parent(s):
a42f963
Cat dog
Browse files
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
def is_cat(x): return x[0].isupper()
|
|
|
5 |
|
6 |
+
learn = load_learner('export.pkl')
|
7 |
+
|
8 |
+
categories = ['cat', 'dog']
|
9 |
+
|
10 |
+
def predict_image(img):
|
11 |
+
pred, pred_idx, probs = learn.predict(img)
|
12 |
+
return dict(zip(categories, map(float, probs)))
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(192, 192))
|
15 |
+
label = gr.outputs.Label()
|
16 |
+
examples = ["cat.jpg", "dog.jpg"]
|
17 |
+
gr.Interface(fn=predict_image, inputs=image, outputs=label, capture_session=True).launch()
|
cat.jpg
ADDED
![]() |
dog.jpg
ADDED
![]() |
dogs_cats.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|