File size: 642 Bytes
52036a4
414780b
6f4b248
6b05da6
269d505
38e3293
 
 
269d505
52036a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269d505
 
52036a4
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
import gradio as gr
from PIL import Image
import numpy as np
import yolov5

model = yolov5.load('keremberke/yolov5n-license-plate')
model.conf = 0.25
model.iou = 0.45

def detect(img: Image.Image):
    img = img.convert("RGB")
    arr = np.array(img)
    results = model(arr, size=640)
    results.render()
    annotated = results.ims[0]
    return Image.fromarray(annotated)

demo = gr.Interface(
    fn=detect,
    inputs=gr.Image(type="pil"),
    outputs=gr.Image(type="pil"),
    title="🔍 Detector de Matrículas",
    description="Sube una imagen y detecto matrículas usando YOLOv5n."
)

if __name__ == "__main__":
    demo.launch()