Skip to main content

Digital Pathology Development Kit Client

Project description

dpkit

Python Client of the Module API for Pathology

Install

Make sure you create a virtual environment, activate it, and then install the dpkit client:

python3 -m pip install dpkit-client

Usage

from time import sleep

from dpkit import AnalysisRequest, Client
from requests_toolbelt import sessions


with sessions.BaseUrlSession(base_url="http://localhost:5000/") as s:
    c = Client(s)

    # let's create a fileset by uploading the content of "input_dir"
    fileset = c.upload(input_dir)

    # then, request an analysis
    analysis = c.new_analysis(AnalysisRequest(
        module="hello_world_v1",
        inputs={
            "wsi": f"@{fileset.id}",
        },
    ))

    # this may take time so wait for the analysis to end
    while True:
        analysis = c.get_analysis(analysis.id)
        if analysis.state == State.FAILED:
            raise RuntimeError(f"last update: {analysis.changes[-1]}")
        if analysis.state == State.COMPLETE:
            break
        sleep(5)

    # analysis is complete so let's download the results
    c.download(analysis, result_dir)

    # and display the analysis itself
    print(analysis.model_dump_json(indent=2))

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

dpkit_client-0.0.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

dpkit_client-0.0.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file dpkit_client-0.0.1.tar.gz.

File metadata

  • Download URL: dpkit_client-0.0.1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for dpkit_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 18b0fd78efc471b8c923398b679810cc421f7a10238e9ad63ff851d4bb0e851f
MD5 476c29dc3bdeca6b6a55acd1c167ad55
BLAKE2b-256 9ac8a32218efc26cfef1c1731d6b40ee2382e64d5ea6d7f35b334cf7b6e26056

See more details on using hashes here.

File details

Details for the file dpkit_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dpkit_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for dpkit_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dfa9630515b9242b2e62517d91f386ed55d45b997ad173863aea16c602766dee
MD5 cce9260f6965c3008fec01aa65423b51
BLAKE2b-256 5bdecfca3fc277246aba23a9f0374d77a8e7433f30fb67b05211cbc89a66cfca

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