Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://www.lalal.ai/api/help could use a clarification on the /split/ endpoint. #1

Open
josephcatrambone-crucible opened this issue Sep 22, 2023 · 1 comment

Comments

@josephcatrambone-crucible
Copy link

josephcatrambone-crucible commented Sep 22, 2023

Low priority, as someone who burned a chunk of the afternoon fighting with '{"status": "error", "error": "Required argument \\"params\\" not found"}'.

The Python example uses urllib but even copy-pasting this example I had problems. It might be worth adding examples with aiohttp and requests to the fray somewhere. The working operation of requests.post(f"https://www.lalal.ai/api/split/", headers=headers, data={"params":json.dumps([params])}) can be tricky to find, even with the documentation available.

It might be nice also to accept something like requests.post(..., json=params) alongside the existing multi-part form data. It's a little friendlier on the dev side.

@jingfelix
Copy link

I also encounter with the same question. But I found that the kind of code works as well:

 url_for_split = URL_API + "split/"
    headers = {
        "Authorization": f"license {license}",
    }

    query_args = {'id': file_id, 'stem': stem, 'filter': filter_type, 'splitter': splitter}

    async with httpx.AsyncClient() as client:
        res = await client.post(url_for_split, data=query_args, headers=headers)
        json_data = res.json()

        if json_data["status"] == "error":
            raise RuntimeError(json_data["error"])

I received 200 but with no completed results:

{
    'status': 'success',
    'name': 'test__.mp3',
    'size': 54720,
    'duration': 1,
    'stem': 'vocals',
    'splitter': 'phoenix',
    'preview': None,
    'split': None,
    'player': None,
    'task': {
        'id': [
            'e9a76189-b404-4da3-ba0d-10844d5fae4c',
            '6bfae800-c93e-4115-bb4a-3c078900ad33',
            '65d57d53-a7a6-474a-afdd-f559b3b8bd68',
            '731a8bea-7eaa-465e-a15e-c11b837eaab0'
        ],
        'state': 'success',
        'progress': 0,
        'split_id': '65d57d53-a7a6-474a-afdd-f559b3b8bd68'
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants