Spaces:
Moibe
/
Sleeping

Moibe commited on
Commit
bfb86b3
1 Parent(s): acc42fe

Procesa correctamente imagenes sin texto

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -100,22 +100,24 @@ def inference(img, lang):
100
 
101
  print("Resultado de la inferencia: ")
102
  print(result)
103
- img_path = img
104
- image = Image.open(img_path).convert("RGB")
105
- boxes = [line[0] for line in result]
106
- txts = [line[1][0] for line in result]
107
- scores = [line[1][1] for line in result]
108
- im_show = draw_ocr(image, boxes, txts, scores,
109
- font_path="./simfang.ttf")
110
- print("Impresi贸n de todos los resultados: ")
111
- print("Boxes:")
112
- print(boxes)
113
- print("Texts:")
114
- print(txts)
115
- print("Scores:")
116
- print(scores)
117
-
118
- print("Detecci贸n de Nombre:")
 
 
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