/libpostal-fastapi

Latest libpostal built from source, wrapped in a FastAPI microservice

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

libpostal-fastapi

Latest libpostal built from source, wrapped in a FastAPI microservice.

Build

The build uses optimized cblas_dgemm from OpenBLAS with OpenMP support to accelerate matrix multiplications in libpostal:

docker build . -t libpostal-fastapi

Usage

Start the server:

docker run -it --rm -p 8001:8001 ghcr.io/alpha-affinity/libpostal-fastapi:master

Send requests to the server (note that the same label might occur multiple times):

$ curl 'http://localhost:8001/parse?address=30+w+26th+st,+new+york,+ny&language=en&country=us'
[["30","house_number"],["w 26th st","road"],["new york","city"],["ny","state"]]
$ curl 'http://localhost:8001/expand?address=30+w+26th+st,+new+york,+ny&languages=en&languages=de'
["30 west 26th saint new york ny","30 west 26th saint new york new york",...]
$ curl 'http://localhost:8001/expandparse?address=30+w+26th+st,+new+york,+ny&language=en&country=us'
[[["30","house_number"],["west 26th saint","road"],["new york","city"],["ny","state"]],...]

View all possible query parameters at http://localhost:8001/docs per the type hints in server.py.