whywynn commited on
Commit
feedf3d
1 Parent(s): 9c81123

Updating app.py to fix path issues

Browse files
Files changed (1) hide show
  1. app.py +7 -17
app.py CHANGED
@@ -2,23 +2,13 @@ from fastai.vision.all import *
2
  import gradio as gr
3
  import skimage
4
 
5
- import pathlib
6
-
7
- def load_learner_with_windows_path(fname):
8
- try:
9
- # Attempt to load with normal path handling
10
- learn = load_learner(fname)
11
- return learn
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