FastAPI endpoint to upload PDF and extract tables with 'color' column as JSON.
438
This project exposes a FastAPI endpoint to upload a PDF and extract the table that contains a "color" column as JSON.
Quickstart
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app:app --reload --host 0.0.0.0 --port 8000
python upload_agent.py sample.pdf
Notes
tabula-py to work (Tabula uses a Java backend). Make sure java is on your PATH.tabula.read_pdf parameters or using lattice=True / stream=True.This project is available as a Docker image on Docker Hub.
docker pull truongginjs/pdf-table-extractor:1.0
docker run -p 8000:8000 truongginjs/pdf-table-extractor:1.0
The API will be available at http://localhost:8000.
docker-compose up
This will build and run the service with volume mounting for development.
GET /: Get API information.POST /extract: Upload a PDF and extract the table containing a "color" column as JSON.POST /extract-all-table: Upload a PDF and extract all tables as JSON arrays.Upload a PDF using curl:
curl -X POST "http://localhost:8000/extract" -F "[email protected]"
Or use the provided upload agent:
python upload_agent.py sample.pdf
If you prefer to build the image locally:
docker build -t pdf-table-extractor .
docker run -p 8000:8000 pdf-table-extractor
Content type
Image
Digest
sha256:f332e5846…
Size
267 MB
Last updated
about 1 year ago
docker pull truongginjs/pdf-table-extractor