EngAbod commited on
Commit
3930505
·
1 Parent(s): a084f08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import streamlit as st
2
  import numpy as np
3
  import cv2
 
4
 
5
  def create_blake_image(input_image):
6
  # Read the image from the BytesIO object
7
- img = input_image
8
 
9
  # Get the shape of the original image
10
  height, width, _ = img.shape
@@ -35,7 +36,7 @@ picture = st.camera_input("Take a picture")
35
 
36
  if picture:
37
  # Convert the uploaded image to a Blake-style image
38
- blake_image = create_blake_image(picture.to_ndarray(format="bgr24"))
39
 
40
  # Display the result
41
  st.image(blake_image, caption="Blake-Style Image", use_column_width=True)
 
1
  import streamlit as st
2
  import numpy as np
3
  import cv2
4
+ from io import BytesIO
5
 
6
  def create_blake_image(input_image):
7
  # Read the image from the BytesIO object
8
+ img = cv2.imdecode(np.frombuffer(input_image.read(), np.uint8), -1)
9
 
10
  # Get the shape of the original image
11
  height, width, _ = img.shape
 
36
 
37
  if picture:
38
  # Convert the uploaded image to a Blake-style image
39
+ blake_image = create_blake_image(picture)
40
 
41
  # Display the result
42
  st.image(blake_image, caption="Blake-Style Image", use_column_width=True)