Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1037f47

Browse filesBrowse files
authored
automl: move samples into beta set (GoogleCloudPlatform#3044)
1 parent d4014b0 commit 1037f47
Copy full SHA for 1037f47

File tree

Expand file treeCollapse file tree

3 files changed

+19
-22
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+19
-22
lines changed

‎automl/beta/batch_predict.py

Copy file name to clipboardExpand all lines: automl/beta/batch_predict.py
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
# limitations under the License.
1414

1515

16-
def batch_predict(project_id, model_id, input_uri, output_uri):
17-
"""Batch predict"""
18-
# [START automl_batch_predict_beta]
19-
from google.cloud import automl_v1beta1 as automl
16+
# [START automl_batch_predict_beta]
17+
from google.cloud import automl_v1beta1 as automl
2018

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

20+
def batch_predict(
21+
project_id="YOUR_PROJECT_ID",
22+
model_id="YOUR_MODEL_ID",
23+
input_uri="gs://YOUR_BUCKET_ID/path/to/your/input/csv_or_jsonl",
24+
output_uri="gs://YOUR_BUCKET_ID/path/to/save/results/",
25+
):
26+
"""Batch predict"""
2727
prediction_client = automl.PredictionServiceClient()
2828

2929
# Get the full path of the model.
@@ -49,4 +49,4 @@ def batch_predict(project_id, model_id, input_uri, output_uri):
4949
response.result()
5050
)
5151
)
52-
# [END automl_batch_predict_beta]
52+
# [END automl_batch_predict_beta]

‎automl/beta/delete_dataset.py

Copy file name to clipboardExpand all lines: automl/beta/delete_dataset.py
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@
1313
# limitations under the License.
1414

1515

16-
def delete_dataset(project_id, dataset_id):
17-
"""Delete a dataset."""
18-
# [START automl_delete_dataset_beta]
19-
from google.cloud import automl_v1beta1 as automl
16+
# [START automl_delete_dataset_beta]
17+
from google.cloud import automl_v1beta1 as automl
2018

21-
# TODO(developer): Uncomment and set the following variables
22-
# project_id = "YOUR_PROJECT_ID"
23-
# dataset_id = "YOUR_DATASET_ID"
2419

20+
def delete_dataset(project_id="YOUR_PROJECT_ID", dataset_id="YOUR_DATASET_ID"):
21+
"""Delete a dataset."""
2522
client = automl.AutoMlClient()
2623
# Get the full path of the dataset
2724
dataset_full_id = client.dataset_path(
@@ -30,4 +27,4 @@ def delete_dataset(project_id, dataset_id):
3027
response = client.delete_dataset(dataset_full_id)
3128

3229
print("Dataset deleted. {}".format(response.result()))
33-
# [END automl_delete_dataset_beta]
30+
# [END automl_delete_dataset_beta]

‎automl/beta/delete_dataset_test.py

Copy file name to clipboardExpand all lines: automl/beta/delete_dataset_test.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import datetime
1615
import os
16+
import uuid
1717

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

3939
yield dataset_id
4040

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.