just a heads up to anyone who uses the inference api

#5
by 9dubs - opened

the response.content type is FLAC and not MP3 or WAV or encoded binary in JSON. there is no mention of this anywhere so i thought i should leave this here. oh and dont follow the api documentation page, its incorrect.

const arrayBuffer = await response.arrayBuffer()

const blob = new Blob([arrayBuffer], { type: 'audio/flac' })
const blobUrl = URL.createObjectURL(blob)

for someone use jsvascript

thanks for reminding me, here's for someone using python

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    with open('audio.flac', 'wb') as file:
        file.write(response.content)

Sign up or log in to comment