AmitPress commited on
Commit
f30494f
·
1 Parent(s): 726b078

error handled

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -19,13 +19,13 @@ if photo:
19
  bx = model(image)[0].boxes[0]
20
  col1.write(f"Result: {(classes[int(bx.cls[0])])}")
21
  txt = classes[int(bx.cls[0])]
22
- genus, species = txt.split('-')
23
  data = requests.get(f'https://reptile-database.reptarium.cz/species?genus={genus}&species={species}')
24
  bs = BeautifulSoup(data.content, 'html.parser')
25
  desc = bs.find('td', string='Comment').find_next_sibling('td').text
26
  col1.write(desc)
27
  except:
28
- col1.write(f"Result: Could not detect")
29
  else:
30
  col1.write('Please Upload an Image of a Snake')
31
  col1.write('Result will be shown as soon as the image is uploaded')
 
19
  bx = model(image)[0].boxes[0]
20
  col1.write(f"Result: {(classes[int(bx.cls[0])])}")
21
  txt = classes[int(bx.cls[0])]
22
+ genus, species = txt.split(' ')
23
  data = requests.get(f'https://reptile-database.reptarium.cz/species?genus={genus}&species={species}')
24
  bs = BeautifulSoup(data.content, 'html.parser')
25
  desc = bs.find('td', string='Comment').find_next_sibling('td').text
26
  col1.write(desc)
27
  except:
28
+ col1.write(f"Error: There might be some network issue")
29
  else:
30
  col1.write('Please Upload an Image of a Snake')
31
  col1.write('Result will be shown as soon as the image is uploaded')