Spaces:
Runtime error
Runtime error
Yew Chong
commited on
Commit
•
1174165
1
Parent(s):
3a4b6cf
streamlit
Browse files- db_firestore.py +5 -2
- streamlit/app8.py +5 -0
db_firestore.py
CHANGED
@@ -5,8 +5,11 @@ from firebase_admin import credentials, storage
|
|
5 |
import json, os, dotenv
|
6 |
from dotenv import load_dotenv
|
7 |
load_dotenv()
|
8 |
-
|
9 |
-
os.environ["FIREBASE_CREDENTIAL"] = dotenv.get_key(dotenv.find_dotenv(), "FIREBASE_CREDENTIAL")
|
|
|
|
|
|
|
10 |
cred = credentials.Certificate(json.loads(os.environ.get("FIREBASE_CREDENTIAL")))
|
11 |
firebase_admin.initialize_app(cred,{'storageBucket': 'healthhack-store.appspot.com'}) # connecting to firebase
|
12 |
|
|
|
5 |
import json, os, dotenv
|
6 |
from dotenv import load_dotenv
|
7 |
load_dotenv()
|
8 |
+
try:
|
9 |
+
os.environ["FIREBASE_CREDENTIAL"] = dotenv.get_key(dotenv.find_dotenv(), "FIREBASE_CREDENTIAL")
|
10 |
+
except TypeError:
|
11 |
+
import streamlit as st
|
12 |
+
os.environ["FIREBASE_CREDENTIAL"] = st.secrets["FIREBASE_CREDENTIAL"]
|
13 |
cred = credentials.Certificate(json.loads(os.environ.get("FIREBASE_CREDENTIAL")))
|
14 |
firebase_admin.initialize_app(cred,{'storageBucket': 'healthhack-store.appspot.com'}) # connecting to firebase
|
15 |
|
streamlit/app8.py
CHANGED
@@ -39,6 +39,11 @@ from dotenv import load_dotenv
|
|
39 |
load_dotenv()
|
40 |
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
if "openai_model" not in st.session_state:
|
44 |
st.session_state["openai_model"] = "gpt-3.5-turbo"
|
|
|
39 |
load_dotenv()
|
40 |
|
41 |
|
42 |
+
## Load from streamlit!!
|
43 |
+
os.environ["HF_TOKEN"] = os.environ.get("HF_TOKEN") or st.secrets["HF_TOKEN"]
|
44 |
+
os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY") or st.secrets["OPENAI_API_KEY"]
|
45 |
+
os.environ["FIREBASE_CREDENTIAL"] = os.environ.get("FIREBASE_CREDENTIAL") or st.secrets["FIREBASE_CREDENTIAL"]
|
46 |
+
|
47 |
|
48 |
if "openai_model" not in st.session_state:
|
49 |
st.session_state["openai_model"] = "gpt-3.5-turbo"
|