yupikopi commited on
Commit
baf8aca
1 Parent(s): 13af865

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -37,16 +37,16 @@ def test_image(object_image):
37
  # Convert the file to an opencv image.
38
  file_bytes = np.asarray(bytearray(object_image.read()), dtype=np.uint8)
39
  opencv_image = cv2.imdecode(file_bytes, 1)
40
- opencv_image = cv2.resize(opencv_image, (200, 200))
41
- opencv_image.shape = (1, 200, 200, 3)
42
  opencv_image = preprocess_input(opencv_image)
43
  predictions = model.predict(opencv_image)
44
 
45
  if predictions[0, 0] >= 0.5:
46
- result = 'DOG'
47
  confidence = predictions[0, 0] * 100
48
  else:
49
- result = 'CAT'
50
  confidence = 100 - (predictions[0, 0] * 100)
51
 
52
  return result, round(confidence, 2)
 
37
  # Convert the file to an opencv image.
38
  file_bytes = np.asarray(bytearray(object_image.read()), dtype=np.uint8)
39
  opencv_image = cv2.imdecode(file_bytes, 1)
40
+ opencv_image = cv2.resize(opencv_image, (160, 160))
41
+ opencv_image.shape = (1, 160, 160, 3)
42
  opencv_image = preprocess_input(opencv_image)
43
  predictions = model.predict(opencv_image)
44
 
45
  if predictions[0, 0] >= 0.5:
46
+ result = 'Pikachu'
47
  confidence = predictions[0, 0] * 100
48
  else:
49
+ result = 'Raichu'
50
  confidence = 100 - (predictions[0, 0] * 100)
51
 
52
  return result, round(confidence, 2)