Skip to content

cannot suceed in getting custom model with "category" param #28

@raul-nugis

Description

@raul-nugis

There is no code sample on category model virtually nowhere (but quite a bunch of resources go into training category models)

Based on this github's example, code:

import os, requests, uuid, json
# If you encounter any issues with the base_url or path, make sure
# that you are using the latest endpoint: https://docs.microsoft.com/azure/cognitive-services/translator/reference/v3-0-translate
path = '/translate?api-version=3.0'
params = '&to=et&allowFallback=false&category=fb67ae7d-c962-47dc-ae06-21b6086316c2-INTERNT'
constructed_url = endpoint + path + params

headers = {
    'Ocp-Apim-Subscription-Key': key,
    'Ocp-Apim-Subscription-Region': region,
    'Content-type': 'application/json',
    'X-ClientTraceId': str(uuid.uuid4())
}

# You can pass more than one object in body.
body = [{
    'text' : 'Hello World!'
}]
request = requests.post(constructed_url, headers=headers, json=body)
response = request.json()

print(json.dumps(response, sort_keys=True, indent=4, ensure_ascii=False, separators=(',', ': ')))

Error:

{
    "error": {
        "code": 400079,
        "message": "The custom system requested for translation between from and to language does not exist."
    }
}

image

image

This model is dictionary, but full models give same error

If I replace params with

params = '&to=et&category=fb67ae7d-c962-47dc-ae06-21b6086316c2-INTERNT'

Then it responds (though custom model is required, not the fallback)

Please help figure out what is missing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions