Procesa correctamente imagenes sin texto
Browse files
app.py
CHANGED
@@ -100,22 +100,24 @@ def inference(img, lang):
|
|
100 |
|
101 |
print("Resultado de la inferencia: ")
|
102 |
print(result)
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
119 |
|
120 |
return result
|
121 |
|
|
|
100 |
|
101 |
print("Resultado de la inferencia: ")
|
102 |
print(result)
|
103 |
+
|
104 |
+
if result is not None:
|
105 |
+
|
106 |
+
#Hacer 茅sto solo si result no es None.
|
107 |
+
img_path = img
|
108 |
+
image = Image.open(img_path).convert("RGB")
|
109 |
+
boxes = [line[0] for line in result]
|
110 |
+
txts = [line[1][0] for line in result]
|
111 |
+
scores = [line[1][1] for line in result]
|
112 |
+
im_show = draw_ocr(image, boxes, txts, scores,
|
113 |
+
font_path="./simfang.ttf")
|
114 |
+
print("Impresi贸n de todos los resultados: ")
|
115 |
+
print("Boxes:")
|
116 |
+
print(boxes)
|
117 |
+
print("Texts:")
|
118 |
+
print(txts)
|
119 |
+
print("Scores:")
|
120 |
+
print(scores)
|
121 |
|
122 |
return result
|
123 |
|