Spaces:
Runtime error
Runtime error
image saved using pil
Browse files
app.py
CHANGED
|
@@ -31,13 +31,14 @@ def main():
|
|
| 31 |
if img_file_buffer is not None:
|
| 32 |
# Convert the image to a NumPy array
|
| 33 |
image = Image.open(img_file_buffer)
|
|
|
|
| 34 |
# image_np = np.array(image)
|
| 35 |
# resized_image = cv2.resize(image_np, (640, 640))
|
| 36 |
# resized_image = resized_image.astype(np.uint8)
|
| 37 |
# resized_image = cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB)
|
| 38 |
# image = cv2.imread(img_file_buffer)
|
| 39 |
-
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 40 |
-
cv2.imwrite('fruit_image.jpg', image)
|
| 41 |
|
| 42 |
model = load_learner(MODEL_PATH)
|
| 43 |
model_output = model.predict('fruit_image.jpg')
|
|
|
|
| 31 |
if img_file_buffer is not None:
|
| 32 |
# Convert the image to a NumPy array
|
| 33 |
image = Image.open(img_file_buffer)
|
| 34 |
+
image.save('fruit_image.jpg')
|
| 35 |
# image_np = np.array(image)
|
| 36 |
# resized_image = cv2.resize(image_np, (640, 640))
|
| 37 |
# resized_image = resized_image.astype(np.uint8)
|
| 38 |
# resized_image = cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB)
|
| 39 |
# image = cv2.imread(img_file_buffer)
|
| 40 |
+
# image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 41 |
+
# cv2.imwrite('fruit_image.jpg', image)
|
| 42 |
|
| 43 |
model = load_learner(MODEL_PATH)
|
| 44 |
model_output = model.predict('fruit_image.jpg')
|