Transformers-Tutorials icon indicating copy to clipboard operation
Transformers-Tutorials copied to clipboard

streamlit app using Table Transformer and OCR

Open salman-moh opened this issue 3 years ago • 5 comments
trafficstars

addition of OCR to download tables directly as csv files. HF space link: https://huggingface.co/spaces/SalML/TableTransformer2CSV

salman-moh avatar Oct 19 '22 07:10 salman-moh

When uploading an image to the app, I'm getting: (probably the table extraction failed on that particular image)

AttributeError: 'UploadedFile' object has no attribute 'split'
Traceback:

File "/home/user/.local/lib/python3.8/site-packages/streamlit/scriptrunner/script_runner.py", line 554, in _run_script
    exec(code, module.__dict__)
File "/home/user/app/app.py", line 501, in <module>
    asyncio.run(te.start_process(img_name, TD_THRESHOLD=0.6, TSR_THRESHOLD=0.8, padd_top=padd_top, padd_left=padd_left, padd_bottom=padd_bottom, padd_right=padd_right, delta_xmin=0, delta_ymin=0, delta_xmax=0, delta_ymax=0, expand_rowcol_bbox_top=0, expand_rowcol_bbox_bottom=0))
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
File "/home/user/app/app.py", line 438, in start_process
    print('No table found in the pdf-page image'+image_path.split('/')[-1])

maxjeblick avatar Oct 19 '22 08:10 maxjeblick

Yea, the model did not find any bbox. Thanks for this, I have updated app to just print out 'no table found' during such a case. Added slider for threshold, lower your threshold and check @maxjeblick

salman-moh avatar Oct 19 '22 09:10 salman-moh

@NielsRogge let me know if any other changes you see fit.

salman-moh avatar Oct 20 '22 06:10 salman-moh

Hi,

thanks for your PR. Maybe it's clearer to just include a link to your demo, I'd like to keep this repo just for notebooks.

NielsRogge avatar Oct 22 '22 09:10 NielsRogge

Sounds good, I have removed app.py and included demo link with screenshot in the readme.

salman-moh avatar Oct 22 '22 09:10 salman-moh