deepl-fastapi
Your own deepl server via fastapi, cross-platform (Windows/Linux/MacOs) with API for OmegaT
Installation
- Create a virual environment: optional but recommended
e.g.,
# Linux and friends python3.7 -m venv .venv source .venv/bin/activate # Windows # py -3.7 -m venv .venv # .venv\Scripts\activate
pip install deepl-fastapi
or (if your use poetry)
poetry add deepl-fastapi
or
pip install git+https://github.com/ffreemt/deepl-fastapi.git
or
- Clone the repo https://github.com/ffreemt/deepl-fastapi.git
git clone https://github.com/ffreemt/deepl-fastapi.git
andcd deepl-fastapi - `pip install -r requirements.txt
- or
poetry install
- or
Usage
- Start the server
Use uvicorn directly (note the deepl_server module, not run_uvicorn)
uvicorn deepl_fastapi.deepl_server:app
or
deepl-fastapi
# this option is available only if installed via pip install or poetry add
or
python3.7 -m deepl_fastapi.run_uvicorn
or run the server on the external net, for example at port 9888
uvicorn deepl_fastapi.deepl_server:app --reload --host 0.0.0.0 --port 9888
- Explore and consume
Point your browser to http://127.0.0.1:8000/text/?q=test&to_lang=zh
Or in python code (pip install requests first)
import requests
# get
url = "http://127.0.0.1:8000/text/?q=test me&to_lang=zh"
print(requests.get(url).json())
# {'q': 'test me', 'from_lang': None, 'to_lang': 'zh',
# 'trtext': '考我 试探我 测试我 试探'}
# post
text = "test this and that"
data = {"text": text, "to_lang": "zh"}
resp = requests.post("http://127.0.0.1:8000/text", json=data)
print(resp.json())
# {'q': {'text': 'test this and that', 'from_lang': None, 'to_lang': 'zh', 'description': None},
# 'result': '试探 左右逢源 检验 审时度势'}
Interactive Docs (Swagger UI)
OmegaT Fake MT plugin setup
- Copy
omegat-plugin-fake-mt-1.0.0.jar(available at https://github.com/briacp/omegat-plugin-fake-mt) to OmegaT\plugins (e.g., C:\Program Files\OmegaT\plugins)
RunOmegaTand setup omegat-plugin-fake-mt
OmegaT/Preferences/Machine Translation/Fake MT/Configure
Name: Fake Deepl MT
URL: http://localhost:8000/text
Source Parameter: from_lang
Target Parameter: to_lang
Text Parameter: q
Metadata
Release files for deepl-fastapi 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deepl-fastapi-0.1.2.tar.gz | 7.1 kB | Without provenance | Details for deepl-fastapi-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deepl_fastapi-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for deepl_fastapi-0.1.2-py3-none-any.whl |
Total release size: 15.1 kB
Release files / deepl-fastapi-0.1.2.tar.gz
| Download URL | deepl-fastapi-0.1.2.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a685d1cbb07122939eca08709d13140196ca7b5b128b107a7bde2a02d38c8e4f
|
|
BLAKE2b-256 checksum How to use checksums |
b89ee2fe539d762c0be91d57b3c64df1de14efeb99577ebb61e6ed3bfee94366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.8.10 Windows/10
|
Release files / deepl_fastapi-0.1.2-py3-none-any.whl
| Download URL | deepl_fastapi-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
005c54fcb0ae6548cdfa0ef73df0af05b50d3390c1279d84b8119a4e19b63f35
|
|
BLAKE2b-256 checksum How to use checksums |
461b7f7aee7076c8bcb4319d0dfdf99cfb192d0e5078026d4e5d73474c2cbf89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.8.10 Windows/10
|
Security for deepl-fastapi 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.