Ver Fonte

modify check_table

chencheng há 1 ano atrás
pai
commit
4d6301d1d0
2 ficheiros alterados com 4 adições e 1 exclusões
  1. 3 1
      cores/check_table.py
  2. 1 0
      server.py

+ 3 - 1
cores/check_table.py

@@ -11,6 +11,7 @@ class Table:
         self.empty = 0
 
     def get_body(self):
+        print(self.html)
         try:
             res = self.html.split('<tbody>')[1]
         except Exception as r:
@@ -24,7 +25,7 @@ class Table:
         return res
 
     def get_tr(self):
-        str = self.get_body()
+        # str = self.get_body()
         if len(str.split('<tr>')) > 1:
             return str.split('<tr>')
         else:
@@ -75,6 +76,7 @@ class Table:
         self.get_empty()
         html_str = self.get_str()
         if (self.empty > 4 and self.empty > self.total // 4) or ('项目' in html_str and '每份' in html_str and '营养素参考值' in html_str and np.max([len(a) for a in self.html_arr])<3):
+            print('识别效果不佳,改变图片颜色!')
             self.change_green2white()
             return 1
         return 0

+ 1 - 0
server.py

@@ -183,6 +183,7 @@ def table(image: TableInfo):
 
     if html:
         post_hander = PostHandler(html)
+        # print(post_hander.format_predict_html)
         return {'html': post_hander.format_predict_html}
     else:
         raise Exception('无法识别')