Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,16 +2,18 @@
|
|
2 |
import gradio as gr
|
3 |
from fastai.vision.all import *
|
4 |
|
|
|
|
|
|
|
|
|
5 |
categories = ('Dog', 'Cat')
|
6 |
learn = load_learner('model.pkl')
|
7 |
def classify_image(img):
|
8 |
pred , idx , probs = learn.predict(img)
|
9 |
return dict(zip(categories , map(float,probs)))
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
image = gr.inputs.image(shape=(192 ,192))
|
14 |
-
label = gr.outputs.Label()
|
15 |
examples = ['dog.jpg', 'cat.jpg', 'dumo.jpg']
|
16 |
demo = gr.Interface(fn=classify_image, inputs=image, outputs= label)
|
17 |
demo.launch(inline = False)
|
|
|
2 |
import gradio as gr
|
3 |
from fastai.vision.all import *
|
4 |
|
5 |
+
def is_cat(x):
|
6 |
+
return x[0].isupper()
|
7 |
+
|
8 |
+
|
9 |
categories = ('Dog', 'Cat')
|
10 |
learn = load_learner('model.pkl')
|
11 |
def classify_image(img):
|
12 |
pred , idx , probs = learn.predict(img)
|
13 |
return dict(zip(categories , map(float,probs)))
|
14 |
|
15 |
+
image = gr.Image()
|
16 |
+
label = gr.Label()
|
|
|
|
|
17 |
examples = ['dog.jpg', 'cat.jpg', 'dumo.jpg']
|
18 |
demo = gr.Interface(fn=classify_image, inputs=image, outputs= label)
|
19 |
demo.launch(inline = False)
|