ak0601 commited on
Commit
b40012c
·
verified ·
1 Parent(s): ba9e19c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -32,6 +32,11 @@ service_account_path = {
32
  "client_x509_cert_url": os.getenv("client_x509_cert_url"),
33
  "universe_domain":os.getenv("universe_domain")
34
  }
 
 
 
 
 
35
  hf_token = os.getenv("HUGGINGFACE_TOKEN")
36
  assert hf_token, "Please set HUGGINGFACE_TOKEN in your .env"
37
  login(token=hf_token)
@@ -80,7 +85,8 @@ vector_store = load_vector_store("Jsons-Colleges/Jsons")
80
  SHEET_KEY = os.getenv("SHEET_KEY")
81
 
82
  def add_query_to_sheet(user_id, query, response):
83
- gc = gspread.service_account_from_dict(service_account_path)
 
84
  sh = gc.open_by_key(SHEET_KEY)
85
  worksheet = sh.worksheet("Sheet1")
86
 
 
32
  "client_x509_cert_url": os.getenv("client_x509_cert_url"),
33
  "universe_domain":os.getenv("universe_domain")
34
  }
35
+
36
+ service_account_info = os.getenv("GOOGLE_SERVICE_ACCOUNT_JSON")
37
+ assert service_account_info, "Missing GOOGLE_SERVICE_ACCOUNT_JSON secret!"
38
+
39
+ service_account_dict = json.loads(service_account_info)
40
  hf_token = os.getenv("HUGGINGFACE_TOKEN")
41
  assert hf_token, "Please set HUGGINGFACE_TOKEN in your .env"
42
  login(token=hf_token)
 
85
  SHEET_KEY = os.getenv("SHEET_KEY")
86
 
87
  def add_query_to_sheet(user_id, query, response):
88
+
89
+ gc = gspread.service_account_from_dict(service_account_dict)
90
  sh = gc.open_by_key(SHEET_KEY)
91
  worksheet = sh.worksheet("Sheet1")
92