File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
from google .cloud import storage
2
2
import os .path
3
3
import os
4
+ import json
5
+
6
+ def fix_json ():
7
+ with open ('keyfile.json' ) as json_file :
8
+ data = json .load (json_file , strict = False )
9
+ with open ("keyfile.json" , "w" ) as outfile :
10
+ json .dump (data , outfile )
11
+
4
12
5
13
def test_file_exists ():
6
14
print ("Key File Exists" )
7
15
print (os .path .isfile ("keyfile.json" ))
16
+
17
+ f = open ("keyfile.json" , "r" )
18
+ print (f .read ())
19
+ fix_json ()
8
20
9
21
def check_if_exists (bucket_name , file_name ):
10
22
storage_client = storage .Client .from_service_account_json ('keyfile.json' )
@@ -64,3 +76,5 @@ def pull_indices():
64
76
download_blob ("symptomizer_indices_bucket-1" , "tfidf.index" , "models/tfidf.index" )
65
77
download_blob ("symptomizer_indices_bucket-1" , "bert.index" , "models/bert.index" )
66
78
download_blob ("symptomizer_indices_bucket-1" , "ids.joblib" , "models/ids.joblib" )
79
+ else :
80
+ print ("No PULL_INDS env found. Rebuilding indices" )
You can’t perform that action at this time.
0 commit comments