prabinpanta0 commited on
Commit
467535b
1 Parent(s): b5074e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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
- # Path to the service account key JSON file
9
- SERVICE_ACCOUNT_KEY_PATH = ".huggingface/idyllic-now-424815-h2-df17361a49ed.json"
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