Emulator for Custom Handlers for Inference Endpoints
🤗 Inference Endpoints offers a secure production solution to easily deploy any 🤗 Transformers and Sentence-Transformers models from the Hub on dedicated and autoscaling infrastructure managed by Hugging Face.
🤗 Inference Endpoints support all of the 🤗 Transformers and Sentence-Transformers tasks as well as custom tasks not supported by 🤗 Transformers yet like speaker diarization and diffusion.
The hf-endpoints-emulator package provides a simple way to test your custom handlers locally before deploying them to Inference Endpoints. It is also useful for debugging your custom handlers.
The package provides a hf-endpoints-emulator command line tool that can be used to run your custom handlers locally. It also provides a hf_endpoint_emulator Python package that can be used to run your custom handlers locally from Python.
Installation
pip install hf-endpoints-emulator
Usage
You can check the examples/ directory for examples on how to use the hf-endpoints-emulator package.
Command Line
hf-endpoints-emulator --handler <handler>
This will start a web server that will run your custom handler. The web server will be accessible at http://localhost:5000. You can then send requests to the web server to test your custom handler.
curl
curl --request POST \
--url http://localhost/:5000 \
--header 'Content-Type: application/json' \
--data '{
"inputs": "I like you."
}'
python
import requests
url = "http://localhost:5000/"
payload = {"inputs": "test"}
headers = {"Content-Type": "application/json"}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.json())
Python pacakge
from hf_endpoints_emulator.emulator import emulate
emulate(handler_path="examples/my_handler.py", port=5000)
Metadata
Release files for hf-endpoints-emulator 0.1.1
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 |
|---|---|---|---|---|
| hf-endpoints-emulator-0.1.1.tar.gz | 5.4 kB | Without provenance | Details for hf-endpoints-emulator-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hf_endpoints_emulator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for hf_endpoints_emulator-0.1.1-py3-none-any.whl |
Total release size: 11.4 kB
Release files / hf-endpoints-emulator-0.1.1.tar.gz
| Download URL | hf-endpoints-emulator-0.1.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9e82c5589159d9d7c9eefd0dba8188e57c511d56ac5fbc3d54d24d9e76ab6cc
|
|
BLAKE2b-256 checksum How to use checksums |
fdf7173c7826a63fbc5837286212a8e50212ac3dbc8a87a81227fc2431266e39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / hf_endpoints_emulator-0.1.1-py3-none-any.whl
| Download URL | hf_endpoints_emulator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac15e1a0845176856db30818017e82b5697ce6ff83627b534c1ef9c2282b99f3
|
|
BLAKE2b-256 checksum How to use checksums |
f93cfaf45c590ae19f2404b805a2aca9b754b16d4043604f83365783dda92f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for hf-endpoints-emulator 0.1.1
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.