Google automl_v1beta1 ошибка "указан неверный идентификатор местоположения" - PullRequest
2 голосов
/ 20 марта 2019

Я пытаюсь вызвать обученную модель из Google Colab с предоставленным примером.

Но есть ошибка.

Кто знает, является ли это бета-ошибкой или я что-то неправильно установил?

Заранее спасибо.

код

from google.cloud import automl_v1beta1 as automl

automl_client = automl.AutoMlClient()

# Create client for prediction service.
prediction_client = 
automl.PredictionServiceClient().from_service_account_json(
        'XXXXX.json')

# Get the full path of the model.
model_full_id = automl_client.model_path(
    project_id, compute_region, model_id
)

# Read the file content for prediction.
#with open(file_path, "rb") as content_file:
snippet = "fsfsf" #content_file.read()

# Set the payload by giving the content and type of the file.
payload = {"text_snippet": {"content": snippet, "mime_type": "text/plain"}}

# params is additional domain-specific parameters.
# currently there is no additional parameters supported.
params = {}
response = prediction_client.predict(model_full_id, payload, params)
print("Prediction results:")
for result in response.payload:
    print("Predicted class name: {}".format(result.display_name))
    print("Predicted class score: {}".format(result.classification.score))

Сообщение об ошибке ^

 InvalidArgument: 400 List of found errors: 1.Field: name; Message: The provided location ID is not valid.  

1 Ответ

0 голосов
/ 18 апреля 2019

Вы должны использовать регион, который поддерживает бета-версию AutoML. Это работает для меня:

create_dataset("myproj-123456", "us-central1", "my_dataset_id", "en", "de")
...