Skip to content

Commit b31572d

Browse files
committed
add requirements.txt
1 parent 76c10c2 commit b31572d

File tree

6 files changed

+12
-60
lines changed

6 files changed

+12
-60
lines changed

language/automl/automl_natural_language_model.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,9 @@ def create_model(project_id, compute_region, dataset_id, model_name):
5454

5555
# Create a model with the model metadata in the region.
5656
response = client.create_model(project_location, my_model)
57-
5857
print("Training operation name: {}".format(response.operation.name))
5958
print("Training started...")
6059

61-
# synchronous check of operation status.
62-
model = response.result()
63-
64-
# Retrieve deployment state.
65-
if model.deployment_state == enums.Model.DeploymentState.DEPLOYED:
66-
deployment_state = "deployed"
67-
else:
68-
deployment_state = "undeployed"
69-
70-
# Display the model information.
71-
print("Model name: {}".format(model.name))
72-
print("Model id: {}".format(model.name.split("/")[-1]))
73-
print("Model display name: {}".format(model.display_name))
74-
print("Model create time:")
75-
print("\tseconds: {}".format(model.create_time.seconds))
76-
print("\tnanos: {}".format(model.create_time.nanos))
77-
print("Model deployment state: {}".format(deployment_state))
78-
7960

8061
# [END automl_natural_language_create_model]
8162

@@ -91,7 +72,9 @@ def get_operation_status(operation_full_id):
9172
client = automl.AutoMlClient()
9273

9374
# Get the latest state of a long-running operation.
94-
response = client._operations_client.get_operation(operation_full_id)
75+
response = client.transport._operations_client.get_operation(
76+
operation_full_id
77+
)
9578

9679
print("Operation status: {}".format(response))
9780

language/automl/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-cloud-automl==0.1.0

translate/automl/automl_translation_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ def get_operation_status(operation_full_id):
216216
client = automl.AutoMlClient()
217217

218218
# Get the latest state of a long-running operation.
219-
response = client._operations_client.get_operation(operation_full_id)
219+
response = client.transport._operations_client.get_operation(
220+
operation_full_id
221+
)
220222

221223
print("Operation status: {}".format(response))
222224

translate/automl/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-cloud-automl==0.1.0

vision/automl/automl_vision_model.py

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -63,44 +63,6 @@ def create_model(
6363
print("Training operation name: {}".format(response.operation.name))
6464
print("Training started...")
6565

66-
# synchronous check of operation status.
67-
model = response.result()
68-
69-
# Retrieve deployment state.
70-
if model.deployment_state == enums.Model.DeploymentState.DEPLOYED:
71-
deployment_state = "deployed"
72-
else:
73-
deployment_state = "undeployed"
74-
# Display the model information.
75-
print("Model name: {}".format(model.name))
76-
print("Model id: {}".format(model.name.split("/")[-1]))
77-
print("Model display name: {}".format(model.display_name))
78-
print("Image classification model metadata:")
79-
print(
80-
"Training budget: {}".format(
81-
model.image_classification_model_metadata.train_budget
82-
)
83-
)
84-
print(
85-
"Training cost: {}".format(
86-
model.image_classification_model_metadata.train_cost
87-
)
88-
)
89-
print(
90-
"Stop reason: {}".format(
91-
model.image_classification_model_metadata.stop_reason
92-
)
93-
)
94-
print(
95-
"Base model id: {}".format(
96-
model.image_classification_model_metadata.base_model_id
97-
)
98-
)
99-
print("Model create time:")
100-
print("\tseconds: {}".format(model.create_time.seconds))
101-
print("\tnanos: {}".format(model.create_time.nanos))
102-
print("Model deployment state: {}".format(deployment_state))
103-
10466

10567
# [END automl_vision_create_model]
10668

@@ -116,7 +78,9 @@ def get_operation_status(operation_full_id):
11678
client = automl.AutoMlClient()
11779

11880
# Get the latest state of a long-running operation.
119-
response = client._operations_client.get_operation(operation_full_id)
81+
response = client.transport._operations_client.get_operation(
82+
operation_full_id
83+
)
12084

12185
print("Operation status: {}".format(response))
12286

vision/automl/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-cloud-automl==0.1.0

0 commit comments

Comments
 (0)