Procházet zdrojové kódy

idc ocr v2.3: fix none words picture

Tinger před 2 roky
rodič
revize
4819198860
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      blues/idc.py

+ 4 - 4
blues/idc.py

@@ -86,11 +86,11 @@ class IdcView(views.MethodView):
         for idx, (ocr_res, _) in enumerate(rec):
             words = [it[1][0].replace(" ", "") for it in ocr_res]
             if which == "face":
-                if not words[0].startswith("姓名"):
+                if not words or not words[0].startswith("姓名"):
                     continue
                 info, msg, sta = get_face_info(words)
             else:
-                if not words[0].startswith("中华"):
+                if not words or not words[0].startswith("中华"):
                     continue
                 info, msg, sta = get_icon_info(words)
             if sta:
@@ -126,11 +126,11 @@ class IdcHtmlView(views.MethodView):
         for idx, (ocr_res, _) in enumerate(rec):
             words = [it[1][0].replace(" ", "") for it in ocr_res]
             if which == "face":
-                if not words[0].startswith("姓名"):
+                if not words or not words[0].startswith("姓名"):
                     continue
                 info, msg, sta = get_face_info(words)
             else:
-                if not words[0].startswith("中华"):
+                if not words or not words[0].startswith("中华"):
                     continue
                 info, msg, sta = get_icon_info(words)
             if sta: