xangcastle's picture
models & requirements
99acab0
raw
history blame
547 Bytes
import gradio as gr
import cv2
from detector.utils import detect_plates, detect_chars
def predict(img):
plates = detect_plates(img)
if len(plates) > 0:
for plate in plates:
p1, p2, crop = plate
if len(crop) > 0:
cv2.rectangle(img, p1, p2, (0, 0, 255), 2)
text, crop = detect_chars(crop)
cv2.putText(img, text, p1, cv2.FONT_HERSHEY_SIMPLEX, 4, (0, 255, 0), 5)
return img
iface = gr.Interface(fn=predict, inputs="image", outputs="image")
iface.launch()