plippe / faiss-web-service

A web service build on top of Facebook's Faiss

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Faiss Web Service

Getting started

The fastest way to get started is to use the docker hub image with the following command:

docker run --rm -it -p 5000:5000 plippe/faiss-web-service:[FAISS_RELEASE]

Once the container is running, you should be able to ping the service:

# Healthcheck
curl 'localhost:5000/ping'

# Faiss search for ids 1, 2, and 3
curl 'localhost:5000/faiss/search' -X POST -d '{"k": 5, "ids": [1, 2, 3]}'

# Faiss search for a vector
curl 'localhost:5000/faiss/search' -X POST -d '{"k": 5, "vectors": [[54.7, 0.3, 0.6, 0.4, 0.1, 0.7, 0.2, 0.0, 0.6, 0.5, 0.3, 0.2, 0.1, 0.9, 0.3, 0.6, 0.2, 0.9, 0.5, 0.0, 0.9, 0.1, 0.9, 0.1, 0.5, 0.5, 0.8, 0.8, 0.5, 0.2, 0.6, 0.2, 0.2, 0.7, 0.1, 0.7, 0.8, 0.2, 0.9, 0.0, 0.4, 0.4, 0.9, 0.0, 0.6, 0.4, 0.4, 0.6, 0.6, 0.2, 0.5, 0.0, 0.1, 0.6, 0.0, 0.0, 0.4, 0.7, 0.5, 0.7, 0.2, 0.5, 0.5, 0.7]]}'

Custom index

By default, the faiss web service will use the files in the resources folder. Those can be overwritten by mounting new ones.

docker run \
    --rm \
    -it \
    -p 5000:5000 \
    -v [PATH_TO_RESOURCES]:/opt/faiss-web-service/resources \
    plippe/faiss-web-service:[FAISS_RELEASE]

Another solution would be to create a new docker image from plippe/faiss-web-service, that adds your resources.

Production

The application runs with Flask's build in server. Flask's documentation clearly states it is not suitable for production.

About

A web service build on top of Facebook's Faiss

License:The Unlicense


Languages

Language:OpenEdge ABL 100.0%Language:Python 0.0%Language:Makefile 0.0%Language:Dockerfile 0.0%