Spaces:
Sleeping
Sleeping
fix gradio on linux
Browse files
app.py
CHANGED
|
@@ -1,24 +1,15 @@
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
import pathlib
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
try:
|
| 10 |
-
res = torch.load(fname, map_location=map_loc, pickle_module=pickle_module)
|
| 11 |
-
except ModuleNotFoundError as e:
|
| 12 |
-
raise ImportError(f"{e}. To load the model on a different device, you may need to install the fastai library.")
|
| 13 |
-
|
| 14 |
-
if 'WindowsPath' in str(type(res.path)):
|
| 15 |
-
res.path = pathlib.Path(res.path)
|
| 16 |
-
|
| 17 |
-
return res
|
| 18 |
|
| 19 |
def is_cat(x): return x[0].isupper()
|
| 20 |
|
| 21 |
-
learn =
|
| 22 |
|
| 23 |
categories = ('dog', 'cat')
|
| 24 |
|
|
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
import pathlib
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
plt = platform.system()
|
| 7 |
+
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
|
| 8 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def is_cat(x): return x[0].isupper()
|
| 11 |
|
| 12 |
+
learn = load_learner('model.pkl')
|
| 13 |
|
| 14 |
categories = ('dog', 'cat')
|
| 15 |
|