Spaces:
Running
Running
valentynliubchenko
commited on
Commit
·
405de8b
1
Parent(s):
6fa0b8b
fixed dependency
Browse files- vertex_ai_service.py +3 -5
vertex_ai_service.py
CHANGED
|
@@ -59,15 +59,13 @@ class VertexAIService(ImageProcessingInterface):
|
|
| 59 |
# Authenticate using the file
|
| 60 |
creds = service_account.Credentials.from_service_account_file(self.json_key_path)
|
| 61 |
else:
|
| 62 |
-
# Get JSON key from environment variable
|
| 63 |
-
json_key = os.getenv(self.json_key_env_var)
|
| 64 |
|
| 65 |
-
if not
|
| 66 |
-
raise ValueError(f"Environment variable {
|
| 67 |
|
| 68 |
# Save JSON key to a temporary file
|
| 69 |
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
|
| 70 |
-
temp_file.write(
|
| 71 |
temp_file_path = temp_file.name
|
| 72 |
|
| 73 |
# Create credentials object
|
|
|
|
| 59 |
# Authenticate using the file
|
| 60 |
creds = service_account.Credentials.from_service_account_file(self.json_key_path)
|
| 61 |
else:
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
if not self.json_key_env_var:
|
| 64 |
+
raise ValueError(f"Environment variable {json_key_env_var} is not set.")
|
| 65 |
|
| 66 |
# Save JSON key to a temporary file
|
| 67 |
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
|
| 68 |
+
temp_file.write(self.json_key_env_var.encode('utf-8'))
|
| 69 |
temp_file_path = temp_file.name
|
| 70 |
|
| 71 |
# Create credentials object
|