File size: 588 Bytes
23123a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import cv2
import numpy as np
import streamlit as st

from src.controllers.sack_detector import SackDetector

uploaded_file = st.file_uploader("Choose a image file", type="jpg")

if uploaded_file is not None:
    # Convert the file to an opencv image.
    file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
    opencv_image = cv2.imdecode(file_bytes, 1)
    detected_image, result = SackDetector().detect_objects(image_path=opencv_image)
    # Now do something with the image! For example, let's display it:
    st.image(detected_image, channels="BGR")