Spaces:
Runtime error
Runtime error
Updating app.py to fix path issues
Browse files
app.py
CHANGED
@@ -2,23 +2,13 @@ from fastai.vision.all import *
|
|
2 |
import gradio as gr
|
3 |
import skimage
|
4 |
|
5 |
-
import
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
except NotImplementedError:
|
13 |
-
# If it fails, assume WindowsPath and convert
|
14 |
-
windows_path = pathlib.WindowsPath(fname)
|
15 |
-
linux_path = windows_path.as_posix()
|
16 |
-
learn = load_learner(linux_path)
|
17 |
-
return learn
|
18 |
-
|
19 |
-
learn = load_learner_with_windows_path('puppy.pkl')
|
20 |
-
|
21 |
-
#learn = load_learner('puppy.pkl')
|
22 |
|
23 |
labels = learn.dls.vocab
|
24 |
|
|
|
2 |
import gradio as gr
|
3 |
import skimage
|
4 |
|
5 |
+
from pathlib import Path
|
6 |
+
|
7 |
+
# Assuming your model file is in the same directory as your script
|
8 |
+
model_path = Path("puppy.pkl")
|
9 |
+
|
10 |
+
# Load the model using the relative path
|
11 |
+
learn = load_learner(model_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
labels = learn.dls.vocab
|
14 |
|