First you need to have an Anthropic API key. Get yours by signing up at Anthropic.
The following packages are required to run the code:
reflex==0.4.6
anthropic
Pillow
Follow the Claude API Tool Use docs and define a extract_table
function that takes an image file and return an extract table as a list of lists.
Export this as an environment variable:
export ANTHROPIC_API_KEY=your_api_key
This app is based on Reflex framework. In the top level directory (this directory has a file named rxconfig.py
), run the following commands to run the app:
reflex init
reflex run
Also check out Reflex Documentation to build/run/host your own app.
- Right now, only support certain image types supported by Anthropic messaging API, no PDFs.
- Only the first table in the image is returned. Experimented with multiple tables and the results were not as good.
- The return table is a plain text representation. Best returned result is a json encoded string of the table, so less post processing code.