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

Pushing app file, examples & requirements v2

Browse files
app.py CHANGED
@@ -2,7 +2,23 @@ from fastai.vision.all import *
2
  import gradio as gr
3
  import skimage
4
 
5
- learn = load_learner('puppy.pkl')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  labels = learn.dls.vocab
8
 
 
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
 
corgi puppy - test.jfif ADDED
Binary file (6.11 kB). View file
 
golden retriever puppy - test.jfif ADDED
Binary file (6.24 kB). View file
 
husky puppy - test.jfif ADDED
Binary file (9.48 kB). View file