Spaces:
Runtime error
Runtime error
add crop
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def execute_text_recognition_tflite( boxes, frame, interpreter, input_details, o
|
|
42 |
license_plate = text
|
43 |
text[:3].replace("0",'O')
|
44 |
|
45 |
-
return text
|
46 |
|
47 |
def greet(image):
|
48 |
resized = cv2.resize(image, (320,320), interpolation=cv2.INTER_AREA)
|
@@ -62,12 +62,13 @@ def greet(image):
|
|
62 |
# For index and confidence value of the first class [0]
|
63 |
for i, confidence in enumerate(output_data[0]):
|
64 |
if confidence > .3:
|
65 |
-
text = execute_text_recognition_tflite(
|
66 |
boxes[0][i], image,
|
67 |
recog_interpreter, recog_input_details, recog_output_details,
|
68 |
)
|
69 |
-
return text
|
70 |
image = gr.inputs.Image(shape=(1920,1080))
|
|
|
71 |
|
72 |
|
73 |
title = "Automatic licence plate detection and recognition"
|
@@ -78,7 +79,7 @@ article = "<p style='text-align: center'><a href='https://ieeexplore.ieee.org/do
|
|
78 |
iface = gr.Interface(
|
79 |
fn=greet,
|
80 |
inputs=image,
|
81 |
-
outputs="text",
|
82 |
title = title,
|
83 |
description = description,
|
84 |
article=article,
|
|
|
42 |
license_plate = text
|
43 |
text[:3].replace("0",'O')
|
44 |
|
45 |
+
return text,cv2.resize(save_frame,(94.42))
|
46 |
|
47 |
def greet(image):
|
48 |
resized = cv2.resize(image, (320,320), interpolation=cv2.INTER_AREA)
|
|
|
62 |
# For index and confidence value of the first class [0]
|
63 |
for i, confidence in enumerate(output_data[0]):
|
64 |
if confidence > .3:
|
65 |
+
text, crop = execute_text_recognition_tflite(
|
66 |
boxes[0][i], image,
|
67 |
recog_interpreter, recog_input_details, recog_output_details,
|
68 |
)
|
69 |
+
return text, crop
|
70 |
image = gr.inputs.Image(shape=(1920,1080))
|
71 |
+
output_image = gr.inputs.Image(shape=(94,24))
|
72 |
|
73 |
|
74 |
title = "Automatic licence plate detection and recognition"
|
|
|
79 |
iface = gr.Interface(
|
80 |
fn=greet,
|
81 |
inputs=image,
|
82 |
+
outputs=["text",output_image],
|
83 |
title = title,
|
84 |
description = description,
|
85 |
article=article,
|