An ML API to compute similarity scores between meta information about sentence examples.
APACHE-2.0 License
An ML API to compute similarity scores between meta information about sentence examples.
The API is programmed with the fastapi
Python package,
uses the packages datasketch
and kshingle
to compute similarity scores.
The deployment is configured for Docker Compose.
Call Docker Compose
export API_PORT=8081
docker-compose -f docker-compose.yml up --build
# or as oneliner:
API_PORT=8081 docker-compose up --build
(Start docker daemon before, e.g. open /Applications/Docker.app
on MacOS).
Check
curl http://localhost:8081
Notes: Only main.py
is used in Dockerfile
.
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt --no-cache-dir
pip install -r requirements-dev.txt --no-cache-dir
(If your git repo is stored in a folder with whitespaces, then don't use the subfolder .venv
. Use an absolute path without whitespaces.)
source .venv/bin/activate
# uvicorn app.main:app --reload
gunicorn app.main:app --reload --bind=0.0.0.0:8081 \
--worker-class=uvicorn.workers.UvicornH11Worker \
--workers=1 --timeout=600
curl -X POST "http://localhost:8081/similarities/" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '[
"Christ, Lena: Die Rumplhanni. In: Deutsche Literatur von Frauen, Berlin: Directmedia Publ. 2001 [1917], S. 13229",
"Christ, Lena: Erinnerungen einer Überflüssigen. In: Deutsche Literatur von Frauen, Berlin: Directmedia Publ. 2001 [1912], S. 12498"
]'
flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')
PYTHONPATH=. pytest
find . -type f -name "*.pyc" | xargs rm
find . -type d -name "__pycache__" | xargs rm -r
rm -r .pytest_cache
rm -r .venv
@software{ulf_hamster_2022_7096467,
author = {Ulf Hamster and
Luise Köhler},
title = {simiscore-biblio: ML API for bibliographic similarities},
month = sep,
year = 2022,
publisher = {Zenodo},
version = {0.1.0},
doi = {10.5281/zenodo.7096467},
url = {https://doi.org/10.5281/zenodo.7096467}
}
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
The "Evidence" project was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - 433249742 (GU 798/27-1; GE 1119/11-1).