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

Uploaded Source

Built Distribution

dpkit_client-0.0.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dpkit_client-0.0.2.tar.gz
  • Upload date:
  • Size: 14.2 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.2.tar.gz
Algorithm Hash digest
SHA256 9a2f50805fafb728ebac011cf543ea5e8d38dd6d041c7e27d3dbe7d370ab9d7a
MD5 ad4de9a73e99e838c15734da5a4eea7c
BLAKE2b-256 45f594e2f8676ed595bc4f1ff16fbab70a90923cb194101e646e4fd986481687

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dpkit_client-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5b4fd2ccbda05b9a45611c9c95d1f84327fe06b6e91100e55f36fa35cd95861f
MD5 ffaf514adf9e1d5eca0d6cd5f6b5b840
BLAKE2b-256 a57b740beddad6869f5981db70d1d98f707614b398d251b29f59e74de7e315b4

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