ServeHub Python client
This is a Python client for ServeHub. It lets you run ML APIs hosted on your infrastructure from anywhere Python runs (pipelines, Jupyter notebooks, etc).
Install
pip install servehub
Authenticate
Before running any Python scripts that use the API, you need to set your ServeHub API token in your environment.
Grab your token from servehub.co/settings and set it as an environment variable:
export SERVEHUB_API_TOKEN=<your token>
We recommend not adding the token directly to your source code, because you don't want to put your credentials in source control. If anyone used your API key, their usage would be charged to your account.
Run a model
Create a new Python file and add the following code:
>>> import servehub
>>> servehub.run(
"<user_name>/<api_name>:<deployment_name>",
input={"prompt": "a 19th century portrait of a wombat gentleman", "another_arg": "its value"}
)
Errors and Exceptions
servehub.exceptions.ServeHubException- The base class that all the below errors inherit from.servehub.exceptions.ServeHubError- Raised when an error originates from ServeHub.servehub.exceptions.ApiNotFoundError- Raised when trying to run an API that does not exist, or that the user doesn't have access to.servehub.exceptions.ApiNotDeployedError- Raised when trying to run an API that is not deployed.servehub.exceptions.ApiError- An error from the deployed API's code.
Release files for servehub 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 | |
|---|---|---|---|
| servehub-0.1.1.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| servehub-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.1 kB
Release files / servehub-0.1.1.tar.gz
| Download URL | servehub-0.1.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e52c7767b210143ad75ca0eb1326bad885abf6a60a33535e48121e360cff51c2
|
|
BLAKE2b-256 checksum How to use checksums |
65fb5b25b607175db84092f9305a905cf698e2140f511a08089fdccc2ed3cb41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / servehub-0.1.1-py3-none-any.whl
| Download URL | servehub-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58daf94f5880af0c6bab581870d7073d70ac509a6ea134fd741450f95649b5e6
|
|
BLAKE2b-256 checksum How to use checksums |
23dbea956acde8f7756f4406a43862f8389c3c759b10cd65a3fd4a40f538cae8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|