Skip to content
Snippets Groups Projects
Commit 4e469fb9 authored by Fabian Rausch's avatar Fabian Rausch
Browse files

Dockerized and documented

parent a8530b58
No related branches found
No related tags found
No related merge requests found
FROM python:3.8-buster
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY auth_key auth_key
COPY deepl_api.py deepl_api.py
EXPOSE 5000
ENTRYPOINT ["python"]
CMD ["deepl_api.py"]
# DeepL API
This service receives a string to translate and returns the translation in the desired language.
This service is part of the [Related Items project](https://gitlab.rrz.uni-hamburg.de/bay1620/wilps-related-items/).
## Local Setup from repository
Due to the secret AUTH KEY there is no possibility here to use an image from Docker Hub. You have to follow these instructions instead:
- Create a file named 'auth_key' in this folder
- Put your AUTH KEY from DeepL Pro into the file (nothing else)
- Build the Docker image from this folder: `docker build -t deepl-api .`
- Run the Docker container: `docker run -p 6061:5050 deepl-api`
## Usage
You can use them - for example using curl - as follows:
- `curl -F text="Guten Abend" -F target_lang=EN -X POST http://0.0.0.0:5050/translate`
......@@ -21,4 +21,4 @@ def get_abstracts_for_query_srf_api():
return get_translation(text, target_lang)
app.config['JSON_AS_ASCII'] = False
app.run(host="0.0.0.0", port=int("6061"), debug=True)
\ No newline at end of file
app.run(host="0.0.0.0", port=int("5050"), debug=True)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment