mtwesley commited on
Commit
7201bd9
·
1 Parent(s): 59348b6

use only streamlit secrets

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -15,25 +15,19 @@ from llama_cpp import Llama
15
 
16
  # --- Configuration & Constants ---
17
 
18
- # Get API keys from environment variables or Streamlit secrets
19
- GEOAPIFY_KEY = os.environ.get("GEOAPIFY_KEY")
20
- if not GEOAPIFY_KEY:
21
- try:
22
- GEOAPIFY_KEY = st.secrets["GEOAPIFY_KEY"]
23
- except KeyError:
24
- st.error("Geoapify API key not found. Please add it to environment variables or Streamlit secrets.")
25
- st.stop()
26
 
27
  # HF_TOKEN is optional but recommended for downloads
28
- HF_TOKEN = os.environ.get("HF_TOKEN")
29
- if not HF_TOKEN:
30
- try:
31
- HF_TOKEN = st.secrets.get("HF_TOKEN")
32
- except KeyError:
33
- HF_TOKEN = None
34
-
35
- if HF_TOKEN:
36
  login(token=HF_TOKEN)
 
 
37
 
38
  # Model and RAG configuration
39
  MODEL_REPO_ID = "bartowski/gemma-2-2b-it-GGUF"
 
15
 
16
  # --- Configuration & Constants ---
17
 
18
+ # Get API key from Streamlit secrets
19
+ try:
20
+ GEOAPIFY_KEY = st.secrets["GEOAPIFY_KEY"]
21
+ except KeyError:
22
+ st.error("Geoapify API key not found. Please add it to Streamlit secrets.")
23
+ st.stop()
 
 
24
 
25
  # HF_TOKEN is optional but recommended for downloads
26
+ try:
27
+ HF_TOKEN = st.secrets.get("HF_TOKEN")
 
 
 
 
 
 
28
  login(token=HF_TOKEN)
29
+ except KeyError:
30
+ HF_TOKEN = None
31
 
32
  # Model and RAG configuration
33
  MODEL_REPO_ID = "bartowski/gemma-2-2b-it-GGUF"