Spaces:
Runtime error
Runtime error
update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
-
|
4 |
-
#fix some issues with Poxixpath
|
5 |
-
# import pathlib
|
6 |
-
# temp = pathlib.PosixPath
|
7 |
-
# pathlib.PosixPath = pathlib.WindowsPath
|
8 |
-
|
9 |
import pathlib
|
|
|
10 |
plt = platform.system()
|
11 |
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
|
12 |
|
@@ -16,12 +11,9 @@ def is_cat(x):
|
|
16 |
learn = load_learner('model.pkl')
|
17 |
|
18 |
# labels = learn.dls.vocab
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
# %time learn.predict(im)
|
23 |
-
|
24 |
-
categories = ('Dog', 'Cat')
|
25 |
|
26 |
def classify_image(img):
|
27 |
pred, idx, probs = learn.predict(img)
|
@@ -36,4 +28,5 @@ intf = gr.Interface(
|
|
36 |
inputs=image,
|
37 |
outputs=label,
|
38 |
examples=examples)
|
39 |
-
|
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import pathlib
|
4 |
+
|
5 |
plt = platform.system()
|
6 |
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
|
7 |
|
|
|
11 |
learn = load_learner('model.pkl')
|
12 |
|
13 |
# labels = learn.dls.vocab
|
14 |
+
#labels #['cat', 'dog']
|
15 |
|
16 |
+
categories = ('cat', 'dog')
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def classify_image(img):
|
19 |
pred, idx, probs = learn.predict(img)
|
|
|
28 |
inputs=image,
|
29 |
outputs=label,
|
30 |
examples=examples)
|
31 |
+
|
32 |
+
intf.launch(inline=False)
|