sidagarwal04 commited on
Commit
c9455c1
·
verified ·
1 Parent(s): b3713a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -10,6 +10,22 @@ from langchain.graphs import Neo4jGraph
10
  from langchain.chains import GraphCypherQAChain
11
  from langchain.memory import ConversationBufferMemory
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  NEO4J_URI = os.getenv("NEO4J_URI")
14
  NEO4J_USERNAME = os.getenv("NEO4J_USERNAME")
15
  NEO4J_PASSWORD = os.getenv("NEO4J_PASSWORD")
 
10
  from langchain.chains import GraphCypherQAChain
11
  from langchain.memory import ConversationBufferMemory
12
 
13
+ # process of getting credentials
14
+ def get_credentials():
15
+ creds_json_str = os.getenv("BOB") # get json credentials stored as a string
16
+ if creds_json_str is None:
17
+ raise ValueError("GOOGLE_APPLICATION_CREDENTIALS_JSON not found in environment")
18
+
19
+ # create a temporary file
20
+ with tempfile.NamedTemporaryFile(mode="w+", delete=False, suffix=".json") as temp:
21
+ temp.write(creds_json_str) # write in json format
22
+ temp_filename = temp.name
23
+
24
+ return temp_filename
25
+
26
+ # pass
27
+ os.environ["GOOGLE_APPLICATION_CREDENTIALS"]= get_credentials()
28
+
29
  NEO4J_URI = os.getenv("NEO4J_URI")
30
  NEO4J_USERNAME = os.getenv("NEO4J_USERNAME")
31
  NEO4J_PASSWORD = os.getenv("NEO4J_PASSWORD")