Skip to main content

Simple access to the TIRA API.

Project description

The TIRA Client

This is a python client for TIRA.io.

Download The results of some Submission

from tira.rest_client_api import Client

tira = Client()
output = tira.get_run_output('<task>/<team>/<approach>', '<dataset>')

Export datasets

You can export datasets if you are the owner or if the dataset is public. Export a dataset via the cli:

tira-run --export-dataset '<task>/<tira-dataset>' --output-directory tira-dataset

Export a dataset via the python API:

from tira.rest_api_client import Client

tira = Client()
tira.download_dataset('<task>', '<tira-dataset>')

Running Jupyter Notebooks with TIRA

docker build -t tira/submission-base-image:1.0.0 -f Dockerfile .

Testing the model locally can be done using the following command:

tira-run \
  --input-directory ${PWD}/input \
  --output-directory ${PWD}/output \
  --image tira/submission-base-image:1.0.0 \
  --command 'tira-run-notebook --input $inputDataset --output $outputDir /workspace/template-notebook.ipynb'

Afterwards you can push the image to TIRA

docker push tira/submission-base-image:1.0.0

and set the command:

tira-run-notebook --input $inputDataset --output $outputDir /workspace/template-notebook.ipynb

Finally, if the actual processing in notebook is toggled via is_running_as_inference_server() (as seen in the template notebook) and your notebook defines a function named predict in the format

def predict(input_list: List) -> List:

you can start an inference server for your model with:

PORT=8001

docker run --rm -it --init \
  -v "$PWD/logs:/workspace/logs" \
  -p $PORT:$PORT \
  tira/submission-base-image:1.0.0 \
  tira-run-inference-server --notebook /workspace/template-notebook.ipynb --port $PORT

Exemplary request for a server running on localhost:8001 are

# POST (JSON list as payload)
curl -X POST -H "application/json" \
  -d "[\"element 1\", \"element 2\", \"element 3\"]" \
  localhost:8001

and

# GET (JSON object string(s) passed to the 'payload' parameter)
curl "localhost:8001?payload=\"element+1\"&payload=\"element+2\"&payload=\"element+3\""

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

tira-0.0.62.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

tira-0.0.62-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file tira-0.0.62.tar.gz.

File metadata

  • Download URL: tira-0.0.62.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tira-0.0.62.tar.gz
Algorithm Hash digest
SHA256 d07f171cc4052871311e6d9baa9aa9be5d9eda80a2eb962b6e0ab91c7563cd0d
MD5 84fd028d42183ccdf4947061fa2bfc43
BLAKE2b-256 7219a8f521357132ed1446fff7760121e7357bc7e31c5b8abe226341942468ca

See more details on using hashes here.

File details

Details for the file tira-0.0.62-py3-none-any.whl.

File metadata

  • Download URL: tira-0.0.62-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tira-0.0.62-py3-none-any.whl
Algorithm Hash digest
SHA256 bb2d31d546c27436c00f74d969d7e337038d6bea46419aa6e132fa7634bc2311
MD5 700d0ab0615edff9b33b6ad02c5eff3b
BLAKE2b-256 d8cd3e9d0d375bae228270c2b0e1ff7e883cf96f10a6505d6f7c2398c2f89000

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