Spaces:
Runtime error
Runtime error
prabinpanta0
commited on
Commit
·
467535b
1
Parent(s):
b5074e8
Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,12 @@ import vertexai
|
|
4 |
from vertexai.generative_models import GenerativeModel
|
5 |
import vertexai.preview.generative_models as generative_models
|
6 |
import gradio as gr
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
# Read the service account key JSON file and set the environment variable
|
12 |
with open(SERVICE_ACCOUNT_KEY_PATH) as f:
|
13 |
service_account_info = json.load(f)
|
14 |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = SERVICE_ACCOUNT_KEY_PATH
|
|
|
4 |
from vertexai.generative_models import GenerativeModel
|
5 |
import vertexai.preview.generative_models as generative_models
|
6 |
import gradio as gr
|
7 |
+
# Read the service account key JSON file path from environment variable
|
8 |
+
SERVICE_ACCOUNT_KEY_PATH = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
|
9 |
|
10 |
+
if not SERVICE_ACCOUNT_KEY_PATH:
|
11 |
+
raise ValueError("The GOOGLE_APPLICATION_CREDENTIALS environment variable is not set.")
|
12 |
|
|
|
13 |
with open(SERVICE_ACCOUNT_KEY_PATH) as f:
|
14 |
service_account_info = json.load(f)
|
15 |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = SERVICE_ACCOUNT_KEY_PATH
|