Skip to content

Commit

Permalink
samples: fixed wrong format on GCS input Uri (#4270)
Browse files Browse the repository at this point in the history
## Description

Current predict sample indicates that it can multiples GCS URI inputs but it should be singular.

## Checklist
- [X] Please **merge** this PR for me once it is approved.
  • Loading branch information
munkhuushmgl authored Jul 10, 2020
1 parent 89904a2 commit 6231735
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tables/automl/automl_tables_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def batch_predict(
project_id,
compute_region,
model_display_name,
gcs_input_uris,
gcs_input_uri,
gcs_output_uri,
):
"""Make a batch of predictions."""
Expand All @@ -94,17 +94,19 @@ def batch_predict(
# project_id = 'PROJECT_ID_HERE'
# compute_region = 'COMPUTE_REGION_HERE'
# model_display_name = 'MODEL_DISPLAY_NAME_HERE'
# gcs_input_uris = ['gs://path/to/file.csv]
# gcs_output_uri = 'gs://path'
# gcs_input_uri = 'gs://YOUR_BUCKET_ID/path_to_your_input_csv'
# gcs_output_uri = 'gs://YOUR_BUCKET_ID/path_to_save_results/'

from google.cloud import automl_v1beta1 as automl

client = automl.TablesClient(project=project_id, region=compute_region)

# Query model
response = client.batch_predict(gcs_input_uris=gcs_input_uris,
gcs_output_uri_prefix=gcs_output_uri,
model_display_name=model_display_name)
response = client.batch_predict(
gcs_input_uris=gcs_input_uri,
gcs_output_uri_prefix=gcs_output_uri,
model_display_name=model_display_name,
)
print("Making batch prediction... ")
response.result()
print("Batch prediction complete.\n{}".format(response.metadata))
Expand Down

0 comments on commit 6231735

Please sign in to comment.