Vahe commited on
Commit
6244e10
·
1 Parent(s): fb25007

pil used to load image

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import cv2
3
  import numpy as np
4
- # from PIL import Image, ImageDraw
5
  # import imutils
6
  # import easyocr
7
  # import os
@@ -30,12 +30,12 @@ def main():
30
  # Check if an image is captured
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
 
 
1
  import streamlit as st
2
  import cv2
3
  import numpy as np
4
+ from PIL import Image
5
  # import imutils
6
  # import easyocr
7
  # import os
 
30
  # Check if an image is captured
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