A package that sets up a local API Endpoint for a model from the HuggingFace Model Hub.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hfendpoint-1.0.4.tar.gz.
File metadata
- Download URL: hfendpoint-1.0.4.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87cdc289f49f41f573f2e101dead6f0b38c54d2ceab33675a32e065cab99f02c
|
|
| MD5 |
d4f2569c8c85cd81a372b5b93e9c49e5
|
|
| BLAKE2b-256 |
2190d9072afc83d450bf05c2209f6f469cd53073cc519446d0ce5fbefd117126
|
File details
Details for the file hfendpoint-1.0.4-py3-none-any.whl.
File metadata
- Download URL: hfendpoint-1.0.4-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bf5d679decd4b6b3c44b9942cecd992d4b3e9144749676744fa634013ef9224
|
|
| MD5 |
d2435ec34e005d2f8ba2b727c323732c
|
|
| BLAKE2b-256 |
10614c67d48d7b81d84706611b2153e8016a4b0120c52d94c794e32f1eca56bf
|