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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file bioml_tasks-0.2.0.tar.gz.

File metadata

  • Download URL: bioml_tasks-0.2.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for bioml_tasks-0.2.0.tar.gz
Algorithm Hash digest
SHA256 20d8e603d84b7bb34f733146eeb484a6732c2a676289b50dfb868c69808c30a3
MD5 e0502946ff42de0d8050f418eda01f76
BLAKE2b-256 793ac003b5aafa7aea13578a1dccc0e05ccc3c450a50b5eeab215b3185cfa3a0

See more details on using hashes here.

File details

Details for the file bioml_tasks-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bioml_tasks-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for bioml_tasks-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4952405455a126d54d934dac5049ace8f1e4a53cbe8160119e4446b2eedd7ff6
MD5 ccb571136370cbb93702e740fe7cf85b
BLAKE2b-256 a001c93cbc703d72b0dcdff343718d9bee39a7319e0531b1d246e932fb66292a

See more details on using hashes here.

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