[README] Add SDK
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import asyncio
|
2 |
-
import json
|
3 |
import string
|
4 |
from collections import Counter
|
5 |
from itertools import count, tee
|
@@ -22,7 +21,8 @@ st.title("Table Detection and Table Structure Recognition")
|
|
22 |
st.write(
|
23 |
"Implemented by MSFT team: https://github.com/microsoft/table-transformer")
|
24 |
|
25 |
-
config = Cfg.load_config_from_name('vgg_transformer')
|
|
|
26 |
config['cnn']['pretrained'] = False
|
27 |
config['device'] = 'cpu'
|
28 |
config['predictor']['beamsearch'] = True
|
@@ -404,7 +404,7 @@ class TableExtractionPipeline():
|
|
404 |
df[col] = df[col].str.replace('}', '', regex=True)
|
405 |
return df
|
406 |
|
407 |
-
|
408 |
def convert_df(self, df):
|
409 |
return df.to_csv().encode('utf-8')
|
410 |
|
|
|
1 |
import asyncio
|
|
|
2 |
import string
|
3 |
from collections import Counter
|
4 |
from itertools import count, tee
|
|
|
21 |
st.write(
|
22 |
"Implemented by MSFT team: https://github.com/microsoft/table-transformer")
|
23 |
|
24 |
+
# config = Cfg.load_config_from_name('vgg_transformer')
|
25 |
+
config = Cfg.load_config_from_name('vgg_seq2seq')
|
26 |
config['cnn']['pretrained'] = False
|
27 |
config['device'] = 'cpu'
|
28 |
config['predictor']['beamsearch'] = True
|
|
|
404 |
df[col] = df[col].str.replace('}', '', regex=True)
|
405 |
return df
|
406 |
|
407 |
+
@st.cache
|
408 |
def convert_df(self, df):
|
409 |
return df.to_csv().encode('utf-8')
|
410 |
|