import requests API_URL = "https://api-inference.huggingface.co/models/facebook/musicgen-large" headers = {"Authorization": "Bearer APITOKEN"} def query(payload): response = requests.post(API_URL, headers=headers, json=payload) return response.content audio_bytes = query({ "inputs": "liquid drum", }) # You can access the audio with IPython.display for example from IPython.display import Audio Audio(audio_bytes)