8uydz commited on
Commit
6bf820d
·
1 Parent(s): fce279d

add if statement if the Model could not predict exactly the breed

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -17,11 +17,15 @@ def tensor2labels(img):
17
  category = categories[index]
18
  print(category)
19
  if 'dog' in category:
20
- category.remove('dog')
21
- return f"This is a Dog and belongs to the breed: {category.pop()}"
 
 
22
  elif 'cat' in category:
23
- category.remove('cat')
24
- return f"This is a Cat and belongs to the breed: {category.pop()}"
 
 
25
  else:
26
  raise Exception
27
 
 
17
  category = categories[index]
18
  print(category)
19
  if 'dog' in category:
20
+ category.remove('dog')
21
+ if len(category)==0:
22
+ return f"This is a Dog and I am not smart enough to know what breed it is :(("
23
+ return f"This is a Dog and belongs to the breed: {category.pop()}"
24
  elif 'cat' in category:
25
+ category.remove('cat')
26
+ if len(category)==0:
27
+ return f"This is a Cat and I am not smart enough to know what breed it is :(("
28
+ return f"This is a Cat and belongs to the breed: {category.pop()}"
29
  else:
30
  raise Exception
31