Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bioml_tasks-0.2.0.tar.gz (14.6 kB view hashes)

Uploaded Source

Built Distribution

bioml_tasks-0.2.0-py3-none-any.whl (13.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page