Working with different libraries like OpenCv on streamlit

Hello,
I was wondering if there is a way to combine opencv and streamlit, and I tried this β†’
image
image

when i run my these codes, i get the error β†’

lab  = test(im)
image = cv2.imread(img)
TypeError: Can't convert object of type 'UploadedFile' to 'str' for 'filename'

Hey @PrajG , this works for me:

import streamlit as st
from PIL import Image
import cv2
import numpy as np

up_file = st.file_uploader("upload")
image = Image.open(up_file)
image = np.array(image)
image = cv2.rotate(image,cv2.ROTATE_90_CLOCKWISE)
st.image(image)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.