Spaces:
Sleeping
Sleeping
from ultralytics import YOLO | |
import cv2 | |
from func import plate_reader | |
from sort.sort import * | |
import os | |
from PIL import Image | |
from util import get_car | |
import streamlit as st | |
from micro_ocr import plate_rec | |
yolo_model = YOLO('yolov8n.pt') | |
license_plate_detector = YOLO('plate.pt') | |
uploaded_file = st.file_uploader("Choose a file") | |
if uploaded_file is not None: | |
image = Image.open(uploaded_file) | |
#image = image.rotate(270, expand=True) | |
st.image(image) | |
img_np = np.array(image) | |
if os.path.exists("img.jpg"): | |
os.remove("img.jpg") | |
cv2.imwrite("img.jpg",img_np) | |
# Basit bir düğme ekleyin | |
if st.button("Bu bir düğme"): | |
#img = cv2.imread("img.jpg") | |
text, p = plate_reader(license_plate_detector,yolo_model,"img.jpg") | |
st.image(image) | |
st.image(p) | |
st.text(text) | |