Skip to main content

Python sdk for music.ai

Project description

Music.ai Python Client Library

This is a Python client library for the Music.AI API. For more information on the API and its capabilities, see the API documentation.

Installation

You can install the library via pip:

pip install musicai_sdk

Usage

Here's an example of how you can use the client to upload a local file, create a job and more:

from musicai_sdk import MusicAiClient

client = MusicAiClient(api_key='your-api-key')

# Get application info
app_info = client.get_application_info()
print('Application Info:', app_info)

# Upload local file
file_url = client.upload_file(file_path='your-file-path')
print('File Url:', file_url)

# Create Job
workflow_params = {
    'inputUrl': file_url,
}
create_job_info = client.create_job(job_name='your-job-name', workflow_id='your-workflow-id',params=workflow_params)
job_id = create_job_info['id']
print('Job Created:', job_id)

# Wait for job to complete
job_info = client.wait_for_job_completion(job_id)
print('Job Status:', job_info['status'])
print('Job Result:', job_info['result'])

# Get job info
job_info = client.get_job(job_id=job_id)
print('Job Status:', job_info['status'])
print('Job Result:', job_info['result'])

# Delete job
client.delete_job(job_id=job_id)

# Get all jobs
jobs = client.get_jobs()
print('Jobs:', jobs)

The library also provides a process_folder function that you can use to process all files in a folder. Please keep in mind this requires a workflow with a single input file. Here's an example of how you can use this function:

from musicai_sdk import MusicAiClient, process_folder

client = MusicAiClient(api_key='your-api-key')

# Use the "parallelism" parameter to set the number of parallel processes and the "delete" parameter to delete the job at MusicAI platform after download completion.
process_folder(input_folder="local input folder", output_folder="local output folder", workflow_id="workflow ID", client=client, parallelism=10, delete=True)

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

musicai_sdk-0.4.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

musicai_sdk-0.4.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file musicai_sdk-0.4.1.tar.gz.

File metadata

  • Download URL: musicai_sdk-0.4.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1022-azure

File hashes

Hashes for musicai_sdk-0.4.1.tar.gz
Algorithm Hash digest
SHA256 9ebec5c73ca5d06cccab2d36edd033ee956f476dac5c7ac503d048938bff05cb
MD5 ae0c68b8e77e4f0b4c7ef7c8486b2ea7
BLAKE2b-256 045ebedb1441cdd35cf5091ebbe72aa7775ad5baac633dd98706e0450db06a58

See more details on using hashes here.

File details

Details for the file musicai_sdk-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: musicai_sdk-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1022-azure

File hashes

Hashes for musicai_sdk-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9637d6475e40b2070b8a799c3bfbabdf1556dc818db59dee1709564e551557b
MD5 975b099e3198e71bcee2c3d862972a6b
BLAKE2b-256 1c373b7401a32b1a8d6e613f513a63be329aa2befbb8bac64683da0cca1358fb

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page