mpfoley73 commited on
Commit
f50cad2
·
1 Parent(s): d0d6c51

Fix PosixPath

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -11,8 +11,14 @@
11
  import gradio as gr
12
  from fastai.vision.all import *
13
  import skimage
 
14
 
15
- learn = load_learner('dog_breed_classifier.pkl')
 
 
 
 
 
16
 
17
  labels = learn.dls.vocab
18
  def predict(img):
@@ -22,10 +28,10 @@ def predict(img):
22
 
23
  title = "Dog Breed Classifier"
24
  description = "A dog breed classifier trained on the Dog Breed dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
25
- article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
26
  examples = ['chester_14.jpg']
27
- interpretation='default'
28
- enable_queue=True
29
 
30
  # Construct a Gradio Interface object from the function (usually an ML model
31
  # inference function), Gradio input components (the number should match the
@@ -41,5 +47,5 @@ gr.Interface(
41
  article=article,
42
  examples=examples,
43
  # interpretation=interpretation,
44
- enable_queue=enable_queue
45
  ).launch()
 
11
  import gradio as gr
12
  from fastai.vision.all import *
13
  import skimage
14
+ import pathlib
15
 
16
+ posix_backup = pathlib.PosixPath
17
+ try:
18
+ pathlib.PosixPath = pathlib.WindowsPath
19
+ learn = load_learner('dog_breed_classifier.pkl')
20
+ finally:
21
+ pathlib.PosixPath = posix_backup
22
 
23
  labels = learn.dls.vocab
24
  def predict(img):
 
28
 
29
  title = "Dog Breed Classifier"
30
  description = "A dog breed classifier trained on the Dog Breed dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
31
+ article="<p style='text-align: center'><a href='https://mpfoley73.netlify.app/post/2024-07-21-deploying-a-deep-learning-model/' target='_blank'>Blog post</a></p>"
32
  examples = ['chester_14.jpg']
33
+ # interpretation='default'
34
+ # enable_queue=True
35
 
36
  # Construct a Gradio Interface object from the function (usually an ML model
37
  # inference function), Gradio input components (the number should match the
 
47
  article=article,
48
  examples=examples,
49
  # interpretation=interpretation,
50
+ # enable_queue=enable_queue
51
  ).launch()