File size: 835 Bytes
ffbdc6a
 
1872897
ffbdc6a
 
 
 
 
 
 
 
3437949
ffbdc6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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('models/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)