fetch-embed
fetch multilingual embed from embed.ttw.workers.dev
Install it
pip install -U fetch-embed
Use it
Make use of the helper function embed_text
endpoints for two models (dim-52 and dim-768)
via cloudflare: https://embed.ttw.workers.dev/embed/ and https://embed.ttw.workers.dev/embed_la/
In case you cannot access embed.ttw.workers.dev, you may use ttw.hopto.org (hosted by noip.com) instead.
Swagger UI: Self-docs for these endpoints
https://embed.ttw.workers.dev/docs
Model 1: multilingual, dim-512
The default endpoint is https://embed.ttw.workers.dev/embed/
from fetch_embed.embed_text import embed_text
res = embed_text(["test a", "测试"])
print(res.shape)
# (2, 512)
Model 2: language agnostic, dim-768
endpoint: https://embed.ttw.workers.dev/embed_la/
from fetch_embed.embed_text import embed_text
endpoint = "https://embed.ttw.workers.dev/embed_la/"
res = embed_text(["test a", "测试"], endpoint=endpoint)
print(res.shape)
# (2, 768)
Consult the embed_text.__doc__ (e.g. print(embed_text.__doc__)) or its source code for more details.
Access the API directly
from fetch_embed import fetch_embed
res = fetch_embed("test me")
print(res.shape)
# (1, 512)
print(fetch_embed(["test me", "测试123"]).shape
# (2, 512)
# to turn off live progress bar
res = fetch_embed("test me", livepbar=False)
# brief docs
help(fetch_embed)
# fetch_embed(texts:Union[str, List[str]], endpoint:str='http://ttw.hopto.org/embed/', livepbar:bool=True) -> numpy.ndarray
Fetch embed from endpoint.
Plug in endpoint = "https://embed.ttw.workers.dev/embed_la/" for Model 2, e.g.,
import numpy as np
from fetch_embed import fetch_embed
endpoint = "https://embed.ttw.workers.dev/embed_la/"
res = fetch_embed("test me", endpoint=endpoint)
print(np.array(res).shape)
# (1, 768)
Metadata
Release files for fetch-embed 0.1.6
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 |
|---|---|---|---|---|
| fetch-embed-0.1.6.tar.gz | 4.1 kB | Without provenance | Details for fetch-embed-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fetch_embed-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for fetch_embed-0.1.6-py3-none-any.whl |
Total release size: 8.2 kB
Release files / fetch-embed-0.1.6.tar.gz
| Download URL | fetch-embed-0.1.6.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
393fbbb5b8f321ba608c7b3b658e73075688e8ccb637a97dd57976863b03456d
|
|
BLAKE2b-256 checksum How to use checksums |
87f066feec7da6c4361f732ba3cc73a3cbf852dfedaaeb77d01d49d2f27e4915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.7.9 Windows/10
|
Release files / fetch_embed-0.1.6-py3-none-any.whl
| Download URL | fetch_embed-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
743b183aecba22bc9bc669097a23c441310a882fbac6ca8c8a57218251030998
|
|
BLAKE2b-256 checksum How to use checksums |
ba333a3084e6026cfad163b7a51cb9a6194afd586ad0b52273d2697bc05f9cf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.7.9 Windows/10
|
Security for fetch-embed 0.1.6
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.