techasad commited on
Commit
c5bfd2d
·
verified ·
1 Parent(s): 771ebec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -29,9 +29,15 @@ from langchain.prompts import (
29
 
30
 
31
 
32
-
33
-
34
- google_api_key = st.secrets["GOOGLE_API_KEY"]
 
 
 
 
 
 
35
  #api_key2 = st.secrets["OPENAI_API_KEY"]
36
  os.environ["GOOGLE_API_KEY"] = google_api_key
37
 
 
29
 
30
 
31
 
32
+ def get_key():
33
+ try:
34
+ google_api_key = st.secrets["GOOGLE_API_KEY"]
35
+ return google_api_key
36
+ except Exception as e:
37
+ google_api_key = os.environ.get("GOOGLE_API_KEY")
38
+ return google_api_key
39
+
40
+ google_api_key = get_key()
41
  #api_key2 = st.secrets["OPENAI_API_KEY"]
42
  os.environ["GOOGLE_API_KEY"] = google_api_key
43