Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
366 |
elif platform == "web":
|
367 |
print("WEB")
|
368 |
# Handle web case if needed
|
369 |
else:
|
370 |
pass
|
371 |
|
372 |
-
image_data = cv.resize(
|
373 |
-
normalized_image_array = (
|
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)
|