dezbee-rest
Serve ezbee via FastAPI port 5555 ([de|dz]bee may be supported later)
Install it (Python 3.8 only)
pip install dezrest
# pip install git+https://github.com/ffreemt/dezbee-rest
# poetry add git+https://github.com/ffreemt/dezbee-rest
# git clone https://github.com/ffreemt/dezbee-rest && cd dezbee-rest
Python virutal environment (Optional)
You may wish to create a python virutal environment first, e.g.,
mkdir temp-dir && cd temp-dir
py -3.8 -m venv .venv
call .venv\Scripts\activate
pip install dezrest
Post- or Pre-install (same as for ezbee)
pip install fastext
pip install pyicu==2.8 pycld2
pip install https://github.com/ffreemt/ezbee/raw/main/data/artifects/polyglot-16.7.4.tar.gz
In linux/macos, you may need to run (if the required packages are not already present in the system) something similar to
apt install libicu-dev
# or for macos
brew install icu4c
brew link icu4c --force
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
Refer to the pre-install part in workflow file routine-tests.yml
Use it
# sart the server at port 5555 via `uvicorn` with 2 workers
python -m dezrest
# or
dezrest
# or run at external IP
python -m dezrest --host 0.0.0.0
# or dezrest --host 0.0.0.0
# cli help
python -m dezrest --help
# or
dezrest --help
# REST docs (Swagger UI)
http://127.0.0.1:5555/docs
Sample run:
$ dezrest
[D 221220 10:48:21 fastlid:34] fetching lid.176.ftz (once only)
[I 221220 10:48:22 fastlid:44] Downloading https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz (need to do this just once)
[I 221220 10:48:27 __main__:204] pid: C:\mat-dir\playground\venv-python
INFO: Uvicorn running on http://127.0.0.1:5555 (Press CTRL+C to quit)
INFO: Started parent process [486952]
INFO: Started server process [548488]
INFOINFO: Started server process [: Waiting for application startup.
547296]
INFOINFO: Application startup complete.
: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:7114 - "POST /post/ HTTP/1.1" 200 OK
INFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [547296]
To kill the server in Windows, kill the parent process (CTRL+C does not quite work in Windows at least), e.g.
taskkill /f /pid 486952
Test the REST API:
import httpx
res = httpx.post("http://127.0.0.1:5555/post/", json=["test\nlove", "没有\n测试\n其他\n爱"]).json()
print(res)
# [['', '没有', ''], ['test', '测试', '0.75'], ['', '其他', ''], ['love', '爱', '0.87']]
Metadata
Release files for dezrest 0.1.0
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 |
|---|---|---|---|---|
| dezrest-0.1.0.tar.gz | 8.2 kB | Without provenance | Details for dezrest-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dezrest-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dezrest-0.1.0-py3-none-any.whl |
Total release size: 16.6 kB
Release files / dezrest-0.1.0.tar.gz
| Download URL | dezrest-0.1.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cb85ff3d8ac8b587c8fcaa833c1b6634aadfe7b54263992c828f18238c2ca60
|
|
BLAKE2b-256 checksum How to use checksums |
ac2197fc5fcb84ab0233eeeb0f480c274b27acf29c486f035fc729f740f05c66
|
| 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 / dezrest-0.1.0-py3-none-any.whl
| Download URL | dezrest-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73555be258eef116279a93cf6a505eb735aa2937a953264a92ff1fe11f5f11f9
|
|
BLAKE2b-256 checksum How to use checksums |
c500dbc29d58958a17a8fe5af17bf3043d5f82dc6569caff9618cfc7590b3b86
|
| 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 dezrest 0.1.0
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.