Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import yolov5
|
3 |
+
|
4 |
+
# load model
|
5 |
+
model = yolov5.load('keremberke/yolov5m-license-plate')
|
6 |
+
|
7 |
+
# set model parameters
|
8 |
+
model.conf = 0.5 # NMS confidence threshold
|
9 |
+
model.iou = 0.25 # NMS IoU threshold
|
10 |
+
model.agnostic = False # NMS class-agnostic
|
11 |
+
model.multi_label = False # NMS multiple labels per box
|
12 |
+
model.max_det = 1000 # maximum number of detections per image
|
13 |
+
|
14 |
+
def greet(img):
|
15 |
+
results = model(img, size=640)
|
16 |
+
|
17 |
+
return "Hello " + str(results.pred) + "!!"
|
18 |
+
|
19 |
+
iface = gr.Interface(fn=greet, inputs="Image", outputs="text")
|
20 |
+
iface.launch()
|