Skip to content

automl: move samples into beta set #3044

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

Merged
merged 5 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions automl/beta/batch_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
# limitations under the License.


def batch_predict(project_id, model_id, input_uri, output_uri):
"""Batch predict"""
# [START automl_batch_predict_beta]
from google.cloud import automl_v1beta1 as automl
# [START automl_batch_predict_beta]
from google.cloud import automl_v1beta1 as automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# model_id = "YOUR_MODEL_ID"
# input_uri = "gs://YOUR_BUCKET_ID/path/to/your/input/csv_or_jsonl"
# output_uri = "gs://YOUR_BUCKET_ID/path/to/save/results/"

def batch_predict(
project_id="YOUR_PROJECT_ID",
model_id="YOUR_MODEL_ID",
input_uri="gs://YOUR_BUCKET_ID/path/to/your/input/csv_or_jsonl",
output_uri="gs://YOUR_BUCKET_ID/path/to/save/results/",
):
"""Batch predict"""
prediction_client = automl.PredictionServiceClient()

# Get the full path of the model.
Expand All @@ -49,4 +49,4 @@ def batch_predict(project_id, model_id, input_uri, output_uri):
response.result()
)
)
# [END automl_batch_predict_beta]
# [END automl_batch_predict_beta]
13 changes: 5 additions & 8 deletions automl/beta/delete_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
# limitations under the License.


def delete_dataset(project_id, dataset_id):
"""Delete a dataset."""
# [START automl_delete_dataset_beta]
from google.cloud import automl_v1beta1 as automl
# [START automl_delete_dataset_beta]
from google.cloud import automl_v1beta1 as automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# dataset_id = "YOUR_DATASET_ID"

def delete_dataset(project_id="YOUR_PROJECT_ID", dataset_id="YOUR_DATASET_ID"):
"""Delete a dataset."""
client = automl.AutoMlClient()
# Get the full path of the dataset
dataset_full_id = client.dataset_path(
Expand All @@ -30,4 +27,4 @@ def delete_dataset(project_id, dataset_id):
response = client.delete_dataset(dataset_full_id)

print("Dataset deleted. {}".format(response.result()))
# [END automl_delete_dataset_beta]
# [END automl_delete_dataset_beta]
8 changes: 4 additions & 4 deletions automl/beta/delete_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import datetime
import os
import uuid

from google.cloud import automl_v1beta1 as automl
import pytest
Expand All @@ -28,13 +28,13 @@
def dataset_id():
client = automl.AutoMlClient()
project_location = client.location_path(PROJECT_ID, "us-central1")
display_name = "test_" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
display_name = "test_{}".format(uuid.uuid4()).replace("-", "")[:32]
metadata = automl.types.TextExtractionDatasetMetadata()
dataset = automl.types.Dataset(
display_name=display_name, text_extraction_dataset_metadata=metadata
)
dataset = client.create_dataset(project_location, dataset)
dataset_id = dataset.name.split("/")[-1]
response = client.create_dataset(project_location, dataset)
dataset_id = response.name.split("/")[-1]

yield dataset_id

Expand Down