Unverified Commit 7ca195e7 authored by Xiaomeng Zhao's avatar Xiaomeng Zhao Committed by GitHub

Merge pull request #866 from myhloli/dev

fix(table): improve table image processing 
parents 7ec3a653 401dfa4e
...@@ -11,7 +11,6 @@ nvidia-smi ...@@ -11,7 +11,6 @@ nvidia-smi
注意:`CUDA Version` 显示的版本号应 >= 12.1,如显示的版本号小于12.1,请升级驱动 注意:`CUDA Version` 显示的版本号应 >= 12.1,如显示的版本号小于12.1,请升级驱动
```plaintext ```plaintext
```
+---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+
| NVIDIA-SMI 537.34 Driver Version: 537.34 CUDA Version: 12.2 | | NVIDIA-SMI 537.34 Driver Version: 537.34 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+ |-----------------------------------------+----------------------+----------------------+
......
import cv2
from paddleocr.ppstructure.table.predict_table import TableSystem from paddleocr.ppstructure.table.predict_table import TableSystem
from paddleocr.ppstructure.utility import init_args from paddleocr.ppstructure.utility import init_args
from magic_pdf.libs.Constants import * from magic_pdf.libs.Constants import *
...@@ -36,7 +37,8 @@ class ppTableModel(object): ...@@ -36,7 +37,8 @@ class ppTableModel(object):
- HTML (str): A string representing the HTML structure with content of the table. - HTML (str): A string representing the HTML structure with content of the table.
""" """
if isinstance(image, Image.Image): if isinstance(image, Image.Image):
image = np.array(image) image = np.asarray(image)
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
pred_res, _ = self.table_sys(image) pred_res, _ = self.table_sys(image)
pred_html = pred_res["html"] pred_html = pred_res["html"]
# res = '<td><table border="1">' + pred_html.replace("<html><body><table>", "").replace( # res = '<td><table border="1">' + pred_html.replace("<html><body><table>", "").replace(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment