edit app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,7 @@
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
def is_cat(x): return x[0].isupper()
|
4 |
-
|
5 |
-
import pathlib
|
6 |
-
|
7 |
-
@contextmanager
|
8 |
-
def set_posix_windows():
|
9 |
-
posix_backup = pathlib.PosixPath
|
10 |
-
try:
|
11 |
-
pathlib.PosixPath = pathlib.WindowsPath
|
12 |
-
yield
|
13 |
-
finally:
|
14 |
-
pathlib.PosixPath = posix_backup
|
15 |
-
EXPORT_PATH = pathlib.Path("model.pkl")
|
16 |
-
|
17 |
-
with set_posix_windows():
|
18 |
-
learn = load_learner(EXPORT_PATH)
|
19 |
categories = ('dog', 'cat')
|
20 |
def classify_image (img):
|
21 |
pred,idx,probs = learn.predict(img)
|
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
def is_cat(x): return x[0].isupper()
|
4 |
+
learn = load_learner('model.pkl')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
categories = ('dog', 'cat')
|
6 |
def classify_image (img):
|
7 |
pred,idx,probs = learn.predict(img)
|