Spaces:
Sleeping
Sleeping
Commit
·
14c4f39
1
Parent(s):
d13041b
fix: change to env credentials
Browse files
public-prediction/predict_custom_model.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from typing import Dict, List, Union
|
|
|
|
| 2 |
from google.cloud import aiplatform
|
| 3 |
from google.protobuf import json_format
|
| 4 |
from google.protobuf.struct_pb2 import Value
|
|
@@ -20,7 +21,7 @@ def predict_custom_trained_model(
|
|
| 20 |
client_options = {"api_endpoint": api_endpoint}
|
| 21 |
|
| 22 |
credentials = service_account.Credentials.from_service_account_file(
|
| 23 |
-
|
| 24 |
# Initialize client that will be used to create and send requests.
|
| 25 |
# This client only needs to be created once, and can be reused for multiple requests.
|
| 26 |
client = aiplatform.gapic.PredictionServiceClient(
|
|
|
|
| 1 |
from typing import Dict, List, Union
|
| 2 |
+
import os
|
| 3 |
from google.cloud import aiplatform
|
| 4 |
from google.protobuf import json_format
|
| 5 |
from google.protobuf.struct_pb2 import Value
|
|
|
|
| 21 |
client_options = {"api_endpoint": api_endpoint}
|
| 22 |
|
| 23 |
credentials = service_account.Credentials.from_service_account_file(
|
| 24 |
+
os.getenv("GOOGLE_APPLICATION_CREDENTIALS"))
|
| 25 |
# Initialize client that will be used to create and send requests.
|
| 26 |
# This client only needs to be created once, and can be reused for multiple requests.
|
| 27 |
client = aiplatform.gapic.PredictionServiceClient(
|