Skip to main content

Simple access to the TIRA API.

Project description

Export datasets

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

download_dataset(self, task, dataset, truth_dataset=False):

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.38.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

tira-0.0.38-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tira-0.0.38.tar.gz
Algorithm Hash digest
SHA256 c5b6d32b9762a9eb6ff9cfc5b466c14b4c616e81228b3dc8e6788f25ea5850cb
MD5 1d9bb255b1db10e8b2781c565d8fd82a
BLAKE2b-256 4ea8943289ac1d337594350b4aeb0a3a19401fd74eb1204c024e1b447fb99e25

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tira-0.0.38-py3-none-any.whl
Algorithm Hash digest
SHA256 3c75ce7bdd9faf63e55c900573cc99c40367773112e8a3612bb678422f945e52
MD5 f0620a465bde98f551ed0a2c2bc5c976
BLAKE2b-256 fc809bbfcb6033a7f042c9860ad1a398cfb0d827a1d07df20ff8c8d36a2b9dee

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