File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1
1
# Import necessary libraries
2
2
import pandas as pd
3
3
import os
4
+ import json
4
5
5
6
from sklearn .impute import SimpleImputer
6
7
from sklearn .model_selection import train_test_split
23
24
app = Apps (carol )
24
25
settings = app .get_settings ()
25
26
27
+ os .environ ["GOOGLE_APPLICATION_CREDENTIALS" ] = "./application_default_credentials.json"
28
+
29
+ if not os .path .exists (os .environ ["GOOGLE_APPLICATION_CREDENTIALS" ]):
30
+ service_account = settings ['g_serviceaccount' ]
31
+ with open (os .environ ["GOOGLE_APPLICATION_CREDENTIALS" ], "w" ) as json_file :
32
+ json .dump (json .loads (service_account ), json_file , indent = 4 )
33
+ else :
34
+ logging .info ('using the standard file for Google SA.' )
35
+
26
36
os .environ ["OPENAI_ORGANIZATION" ] = settings ['openai_organization' ]
27
37
os .environ ["OPENAI_API_KEY" ] = settings ['openai_api_key' ]
28
38
Original file line number Diff line number Diff line change 24
24
app = Apps (carol )
25
25
settings = app .get_settings ()
26
26
27
- # if not os.path.exists(os.environ["GOOGLE_APPLICATION_CREDENTIALS"]):
28
- # service_account = settings['g_serviceaccount']
29
- # with open(os.environ["GOOGLE_APPLICATION_CREDENTIALS"], "w") as json_file:
30
- # json.dump(json.loads(service_account), json_file, indent=4)
31
- # else:
32
- # logging.info('using the standard file for Google SA.')
27
+ if not os .path .exists (os .environ ["GOOGLE_APPLICATION_CREDENTIALS" ]):
28
+ service_account = settings ['g_serviceaccount' ]
29
+ with open (os .environ ["GOOGLE_APPLICATION_CREDENTIALS" ], "w" ) as json_file :
30
+ json .dump (json .loads (service_account ), json_file , indent = 4 )
31
+ else :
32
+ logging .info ('using the standard file for Google SA.' )
33
33
34
34
os .environ ["OPENAI_ORGANIZATION" ] = settings ['openai_organization' ]
35
35
os .environ ["OPENAI_API_KEY" ] = settings ['openai_api_key' ]
You can’t perform that action at this time.
0 commit comments