romlinux commited on
Commit
97fe8f1
1 Parent(s): 69c301a

Fix the missing name during import of model

Browse files
Files changed (2) hide show
  1. app.py +5 -2
  2. cat_dog_classifier.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,10 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
3
  import os
4
- import os.path
 
 
 
5
 
6
 
7
  def predict(img):
@@ -11,7 +14,7 @@ def predict(img):
11
 
12
 
13
  script_dir = os.path.dirname(os.path.realpath(__file__))
14
- learn_inf = load_learner(script_dir+'/model/cat_dog_classifier.pkl')
15
  labels = learn_inf.dls.vocab
16
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)),
17
  outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
  import os
4
+
5
+
6
+ def get_label_from_file_path(path):
7
+ return os.path.basename(os.path.dirname(path))
8
 
9
 
10
  def predict(img):
 
14
 
15
 
16
  script_dir = os.path.dirname(os.path.realpath(__file__))
17
+ learn_inf = load_learner(script_dir + '/model/cat_dog_classifier.pkl')
18
  labels = learn_inf.dls.vocab
19
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)),
20
  outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
cat_dog_classifier.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e56f957ab5677bc43287f8d04817c5d568fabbe799425bb0ceee977dba88902
3
+ size 46965370