HFEndpoint - Set up local API Endpoint for any HuggingFace model
This package provides the user with one method that opens a local API endpoint for any from HuggingFace Model Hub.
This package utilizes the FastAPI library to set up an API Endpoint under 127.0.0.1:8000/docs. It also makes use of HuggingFace's transformers package, pydantic, and a package I created hfloader. Which can be found here.
Installation
The package can be installed with the following command:
pip install hfendpoint
How to Use
To use this package, all you need to do is import the package via this command.
from hfendpoint import LoadApiEndpoint
The function LoadApiEndpoint expects one variable of type str. This can be a local path to a model, or any package on the HuggingFace Model Hub.
Usage may look something along the lines of:
from hfendpoint import LoadApiEndpoint
app = LoadApiEndpoint("cardiffnlp/twitter-roberta-base-sentiment")
Important:
After running the script and loading the api endpoint, you have to call this command in cmd:
uvicorn script:app --reload
So, if the script that was written was called script.py, you need to exclude the .py in the command call.
Requirements
pip install transformers pip install fastapi pip install uvicorn pip install pydantic
Notes
I don't have plans to upkeep this project unless it necessitates it. I was able to achieve the goal I had set out when developing the package.
Metadata
Release files for hfendpoint 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hfendpoint-1.0.4.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hfendpoint-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.6 kB
Release files / hfendpoint-1.0.4.tar.gz
| Download URL | hfendpoint-1.0.4.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87cdc289f49f41f573f2e101dead6f0b38c54d2ceab33675a32e065cab99f02c
|
|
BLAKE2b-256 checksum How to use checksums |
2190d9072afc83d450bf05c2209f6f469cd53073cc519446d0ce5fbefd117126
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / hfendpoint-1.0.4-py3-none-any.whl
| Download URL | hfendpoint-1.0.4-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bf5d679decd4b6b3c44b9942cecd992d4b3e9144749676744fa634013ef9224
|
|
BLAKE2b-256 checksum How to use checksums |
10614c67d48d7b81d84706611b2153e8016a4b0120c52d94c794e32f1eca56bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|