Jeff Vestal commited on
Commit
3861a69
1 Parent(s): 8af3962
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -6,7 +6,13 @@ import timm
6
 
7
  # quick function to strip the leading ###. off the parent label name
8
  def strip_parent_num(o):
9
- return parent_label(o).split('.')[1]
 
 
 
 
 
 
10
 
11
  # load the model
12
  learn = load_learner('birds-convnext_small_in22k.pkl')
@@ -22,8 +28,7 @@ def predict(img):
22
  # Gradio customizations
23
  title = 'Bird Identifier'
24
  description = 'This model will predict the type of bird from an image.\n\nThe convnext_tiny_in22k model was refined using the CUB_200_2011 bird dataset.'
25
- #examples = ['cardinal1.jpg', 'crow.jpg']
26
- examples = ['siamese.jpg']
27
  interpretation = 'default'
28
  enable_queue = True
29
  article = '''<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Learning from -> Gradio + HuggingFace Spaces: A Tutorial</a></p>'''
 
6
 
7
  # quick function to strip the leading ###. off the parent label name
8
  def strip_parent_num(o):
9
+ #return parent_label(o).split('.')[1]
10
+ try:
11
+ r = parent_label(o).split('.')[1]
12
+ except IndexError:
13
+ r = parent_label(o)
14
+
15
+ return r
16
 
17
  # load the model
18
  learn = load_learner('birds-convnext_small_in22k.pkl')
 
28
  # Gradio customizations
29
  title = 'Bird Identifier'
30
  description = 'This model will predict the type of bird from an image.\n\nThe convnext_tiny_in22k model was refined using the CUB_200_2011 bird dataset.'
31
+ examples = ['cardinal1.jpg', 'crow.jpg']
 
32
  interpretation = 'default'
33
  enable_queue = True
34
  article = '''<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Learning from -> Gradio + HuggingFace Spaces: A Tutorial</a></p>'''