Skip to main content

Python SDK to access Kintsugi Voice API V2.

Project description

Kintsugi Python SDK

Python SDK to access Kintsugi Voice API V2.

Installation

pip install kintsugi-python

Code Example

import os,time
from kintsugi.api import Api


if __name__ == '__main__':
    # Configuration Parameters
    x_api_key = os.environ['X_API_KEY']
    user_id = os.environ['USER_ID']

    # Arguments
    audio_file_1 = open('/Users/jackson/Downloads/test_audio.wav', 'rb')
    audio_file_2 = open('/Users/jackson/Downloads/test_audio.wav', 'rb')
    allowed_sample_rate = 44100
    metadata = {
        'age': 39,
        'gender': 'male'
    }

    # API instantiation
    api = Api(x_api_key=x_api_key)

    # Prediction using all arguments
    api.prediction().predict(
        user_id,
        audio_file_1,
        metadata=metadata,
        allowed_sample_rate=allowed_sample_rate,
    )

    # Prediction using fewer arguments
    session_id = api.prediction().predict(user_id, audio_file_2)

    # Get prediction by session
    prediction_response = api.prediction().get_prediction_by_session(session_id)
    while prediction_response.status == "processing":
      time.sleep(5)
      prediction_response = api.prediction().get_prediction_by_session(session_id)

    print(f'Score for depression: {prediction_response.get_score("depression")}')
    print(f'Score for anxiety: {prediction_response.get_score("anxiety")}')

    # Get predictions by user
    predictions_user = api.prediction().get_prediction_by_user(user_id)

    # Depression feedback
    api.feedback().depression(session_id, 'false')

    # PHQ-2 feedback
    api.feedback().phq_2(session_id, [1, 2])

    # PHQ-9 feedback
    api.feedback().phq_9(session_id, [1, 2, 1, 2, 1, 2, 3, 1, 2])

    # GAD-7 feedback
    api.feedback().gad_7(session_id, [1, 2, 1, 2, 1, 2, 3])

    print('Done.')

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

kintsugi_python-0.1.8.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

kintsugi_python-0.1.8-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file kintsugi_python-0.1.8.tar.gz.

File metadata

  • Download URL: kintsugi_python-0.1.8.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kintsugi_python-0.1.8.tar.gz
Algorithm Hash digest
SHA256 6c7e90e6a76cffa0a9346a3cbd82aead9a3350da6e08fda0c7bc14f42f036cb8
MD5 b4d14c1929633a2a174e115c6c7c95cc
BLAKE2b-256 2cb34df6eae187e95c98f12b9b26d31619969b10cb2d2ad8936f9fe5b2011d85

See more details on using hashes here.

Provenance

The following attestation bundles were made for kintsugi_python-0.1.8.tar.gz:

Publisher: publish-pypi.yml on KintsugiMindfulWellness/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kintsugi_python-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for kintsugi_python-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 30511bf171f0ea5e9a4d81ce0a47a55ec55f31d69b9ba1bfa86ff1ab142cdb81
MD5 b4e7ec2aa8426552012698b26f9385a6
BLAKE2b-256 db71af2ae2723c6c624a038cab9412c8170cc56e6349a762dfb541b85041b42c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kintsugi_python-0.1.8-py3-none-any.whl:

Publisher: publish-pypi.yml on KintsugiMindfulWellness/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page