Spaces:
Build error
Build error
Fix html escape
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ import pytesseract
|
|
| 14 |
from pytesseract import Output
|
| 15 |
|
| 16 |
from bs4 import BeautifulSoup as bs
|
|
|
|
| 17 |
|
| 18 |
import sys, json
|
| 19 |
|
|
@@ -202,7 +203,7 @@ def cells_to_html(cells):
|
|
| 202 |
for cell in r_cells:
|
| 203 |
rowspan = cell['row_nums'][-1] - cell['row_nums'][0] + 1
|
| 204 |
colspan = cell['column_nums'][-1] - cell['column_nums'][0] + 1
|
| 205 |
-
r_html += f'<td rowspan="{rowspan}" colspan="{colspan}">{cell["text"]}</td>'
|
| 206 |
html_code += f'<tr>{r_html}</tr>'
|
| 207 |
html_code = '''<html>
|
| 208 |
<head>
|
|
|
|
| 14 |
from pytesseract import Output
|
| 15 |
|
| 16 |
from bs4 import BeautifulSoup as bs
|
| 17 |
+
from html import escape
|
| 18 |
|
| 19 |
import sys, json
|
| 20 |
|
|
|
|
| 203 |
for cell in r_cells:
|
| 204 |
rowspan = cell['row_nums'][-1] - cell['row_nums'][0] + 1
|
| 205 |
colspan = cell['column_nums'][-1] - cell['column_nums'][0] + 1
|
| 206 |
+
r_html += f'<td rowspan="{rowspan}" colspan="{colspan}">{escape(cell["text"])}</td>'
|
| 207 |
html_code += f'<tr>{r_html}</tr>'
|
| 208 |
html_code = '''<html>
|
| 209 |
<head>
|