Python client for ServeHub
Project description
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.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file servehub-0.1.1.tar.gz
.
File metadata
- Download URL: servehub-0.1.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e52c7767b210143ad75ca0eb1326bad885abf6a60a33535e48121e360cff51c2 |
|
MD5 | 5f8f2d23288fa1d1c55a2fe3a81cddfa |
|
BLAKE2b-256 | 65fb5b25b607175db84092f9305a905cf698e2140f511a08089fdccc2ed3cb41 |
File details
Details for the file servehub-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: servehub-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58daf94f5880af0c6bab581870d7073d70ac509a6ea134fd741450f95649b5e6 |
|
MD5 | 081fb88ed70627498f635b704fd38a67 |
|
BLAKE2b-256 | 23dbea956acde8f7756f4406a43862f8389c3c759b10cd65a3fd4a40f538cae8 |