Skip to content

Commit

Permalink
update firebase access
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudhendra committed Oct 17, 2024
1 parent e43145a commit 2249038
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions medapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
import cv2
from dotenv import load_dotenv
from streamlit_agraph import agraph, Node, Edge, Config
import logging

# Load environment variables
# Load environment variables (for local development)
load_dotenv()

# Set up OpenAI client
Expand Down Expand Up @@ -170,7 +171,7 @@ def build_mindmap(query: str, answer: str, related_topics: List[str]) -> Tuple[L
def get_firebase_key():
# Try to get the key from Streamlit secrets first (for deployed app)
if 'firebase_key' in st.secrets:
return json.loads(st.secrets['firebase_key'])
return st.secrets['firebase_key']

# If not in secrets, try to get from environment variable (for local development)
firebase_key_path = os.getenv("FIREBASE_KEY_PATH")
Expand All @@ -185,7 +186,7 @@ def get_firebase_key():
def main():
# Get Firebase credentials
firebase_key = get_firebase_key()
firebase_collection = os.getenv("FIREBASE_COLLECTION", "counts")
firebase_collection = st.secrets.get('firebase_collection', 'counts')

# Start tracking with Firebase Firestore
streamlit_analytics.start_tracking(
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ faiss-cpu
streamlit_analytics
python-dotenv
streamlit-agraph
firebase-admin
firebase-admin
logging

0 comments on commit 2249038

Please sign in to comment.