MTG / essentia-replicate-demos

Demos of Essentia models hosted on Replicate.com
GNU Affero General Public License v3.0
40 stars 6 forks source link

Inputs to the local API #8

Closed selintunr closed 1 year ago

selintunr commented 1 year ago

Hi @palonso , I got the ML API running locally through cog on http://localhost:8080/predictions. But I couldn't manage to get the results, I'm not sure if I'm sending the inputs to the API correctly. Thank you already, here is my code:

import requests

api_url = "http://localhost:8080/predictions"  

payload = {
    "audio": "input.mp3",
    "top_n": 10,
    "output_format": "JSON"
}

response = requests.post(api_url, json=payload)

if response.status_code == 200:
    predictions = response.json()
    print(predictions)
else:
    print("Error:", response.status_code, response.text)
palonso commented 1 year ago

Hi @selintunr,

Sorry, but I have never used the ML API locally so I can't help you. I suggest you contact Replicate since your question is related to the usage of the API, not our specific model.

That said, I know that when using the online API with the replicate wrapper, the audio input should be the audio as an array of bytes instead of the filename (https://github.com/MTG/essentia-replicate-demos/issues/7#issuecomment-1562816475). Could this be the problem?