tommy24 commited on
Commit
e67965c
·
1 Parent(s): ef75761

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -362,15 +362,15 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
362
  # imageData = cv.imdecode(np.asarray(bytearray(get_image.content), dtype="uint8"), cv.IMREAD_COLOR)
363
  image_bytes = get_image.content
364
  image = Image.open(io.BytesIO(image_bytes))
365
- image_data = cv.cvtColor(np.array(image), cv.COLOR_RGB2BGR)
366
  elif platform == "web":
367
  print("WEB")
368
  # Handle web case if needed
369
  else:
370
  pass
371
 
372
- image_data = cv.resize(image_data, (224, 224))
373
- normalized_image_array = (image_data.astype(np.float32) / 127.0) - 1
374
  data = np.zeros((1, 224, 224, 3))
375
  data[0] = normalized_image_array
376
  prediction = model.predict(data)
 
362
  # imageData = cv.imdecode(np.asarray(bytearray(get_image.content), dtype="uint8"), cv.IMREAD_COLOR)
363
  image_bytes = get_image.content
364
  image = Image.open(io.BytesIO(image_bytes))
365
+ imageData = cv.cvtColor(np.array(image), cv.COLOR_RGB2BGR)
366
  elif platform == "web":
367
  print("WEB")
368
  # Handle web case if needed
369
  else:
370
  pass
371
 
372
+ image_data = cv.resize(imageData, (224, 224))
373
+ normalized_image_array = (imageData.astype(np.float32) / 127.0) - 1
374
  data = np.zeros((1, 224, 224, 3))
375
  data[0] = normalized_image_array
376
  prediction = model.predict(data)