bib-number / app.py
jayllfpt's picture
upload files
aa1a0f3
raw
history blame contribute delete
767 Bytes
import streamlit as st
from BIB_Extraction import BIB_Extract, two_pts
import cv2
import numpy as np
engine = BIB_Extract()
def main():
st.set_page_config(
page_title="BIB Detection",
page_icon=":flag-vn:",
# layout="wide"
)
uploaded_file = st.file_uploader(
"Choose an image...", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
# Convert the uploaded file to an OpenCV image
file_bytes = np.asarray(
bytearray(uploaded_file.read()), dtype=np.uint8)
org_image = cv2.imdecode(file_bytes, 1)
st.image(org_image, channels="BGR", caption='Uploaded Image')
st.text(f"BIB Numbers: {engine(org_image, bib_length=4)}")
if __name__ == '__main__':
main()