Python client for BioML Tasks
Project description
BioML Tasks Python client
This is a Python client for BioML Tasks. It lets you run ML APIs from your Python code or Jupyter notebook.
Install
pip install bioml_tasks
Authenticate
Before running any Python scripts that use the API, you need to set your BioML Tasks API token in your environment.
Grab your token from biomltasks.com/settings and set it as an environment variable:
export BIOML_TASKS_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 bioml_tasks
>>> bioml_tasks.run(
"<user_name>/<api_name>",
input={"prompt": "a 19th century portrait of a wombat gentleman", "another_arg": "its value"}
)
Errors and Exceptions
bioml_tasks.exceptions.MlApiNotFoundError
- Raised when trying to run an API that does not exist, or that the user doesn't have access to.bioml_tasks.exceptions.MlApiNotDeployedError
- Raised when trying to run an API that exists, but is not deployed.bioml_tasks.exceptions.MlApiDeploymentError
- Raised when trying to run an API that has been deployed but is not running. This is usually due to insufficient compute or incorrect setup code.bioml_tasks.exceptions.MlApiError
- An error from the deployed ML API.bioml_tasks.exceptions.BioMlTasksError
- A generic error for all other errors.bioml_tasks.exceptions.BioMlTasksException
- The base class that all the above errors inherit from.
Development
See CONTRIBUTING.md
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 bioml_tasks-0.1.0.tar.gz
.
File metadata
- Download URL: bioml_tasks-0.1.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a082057ea716442e6703abedc5287b502c6d1d7e8956e26f3d3368bd904fa58f |
|
MD5 | 4b0b643217e48756dc28563e364ce525 |
|
BLAKE2b-256 | 4a39ce0ece0167ba73f29e987843d42279d1b947e480ab6dc1637ee997e5f875 |
File details
Details for the file bioml_tasks-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: bioml_tasks-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bb5fbf8d5ca731917f3a10ec0d16772ff774cce9d9f179a2524518fb9079c46 |
|
MD5 | 65548b927883bc633d5610b6280d5647 |
|
BLAKE2b-256 | 3c8d7d58f4241cc2a8953f416b8e85112b46da1e2fe2d391df96eb10d782662a |