Spaces:
Runtime error
Runtime error
Update app.py
Browse filesupdate Gradio features
app.py
CHANGED
@@ -10,7 +10,8 @@ import pathlib
|
|
10 |
plt = platform.system()
|
11 |
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
|
12 |
|
13 |
-
def is_cat(x):
|
|
|
14 |
|
15 |
learn = load_learner('model.pkl')
|
16 |
|
@@ -23,12 +24,16 @@ learn = load_learner('model.pkl')
|
|
23 |
categories = ('Dog', 'Cat')
|
24 |
|
25 |
def classify_image(img):
|
26 |
-
pred,idx,probs = learn.predict(img)
|
27 |
return dict(zip(categories, map(float,probs)))
|
28 |
|
29 |
-
image = gr.
|
30 |
-
label = gr.
|
31 |
examples = ['dog.jpg', 'cat.jpg']
|
32 |
|
33 |
-
intf = gr.Interface(
|
|
|
|
|
|
|
|
|
34 |
intf.launch(inline=False)
|
|
|
10 |
plt = platform.system()
|
11 |
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
|
12 |
|
13 |
+
def is_cat(x):
|
14 |
+
return x[0].isupper()
|
15 |
|
16 |
learn = load_learner('model.pkl')
|
17 |
|
|
|
24 |
categories = ('Dog', 'Cat')
|
25 |
|
26 |
def classify_image(img):
|
27 |
+
pred, idx, probs = learn.predict(img)
|
28 |
return dict(zip(categories, map(float,probs)))
|
29 |
|
30 |
+
image = gr.Image()
|
31 |
+
label = gr.Label()
|
32 |
examples = ['dog.jpg', 'cat.jpg']
|
33 |
|
34 |
+
intf = gr.Interface(
|
35 |
+
fn=classify_image,
|
36 |
+
inputs=image,
|
37 |
+
outputs=label,
|
38 |
+
examples=examples)
|
39 |
intf.launch(inline=False)
|