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.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

musicai_sdk-0.4.0-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

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