Spaces:
Running
Running
recoded secrets section
Browse files
app.py
CHANGED
@@ -143,17 +143,18 @@ cache_path = 'data/impact_theory_cache.parquet'
|
|
143 |
data = load_data(data_path)
|
144 |
cache = None # load_content_cache(cache_path)
|
145 |
|
146 |
-
|
147 |
-
#
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
157 |
# for Huggingface (no [secrets] section)
|
158 |
Wapi_key = st.secrets['WEAVIATE_API_KEY']
|
159 |
url = st.secrets['WEAVIATE_ENDPOINT']
|
@@ -163,8 +164,9 @@ try:
|
|
163 |
hf_endpoint = st.secrets['LLAMA2_ENDPOINT_UPLIMIT']
|
164 |
model_token_id = st.secrets['MODAL_TOKEN_ID']
|
165 |
modal_token_secret = st.secrets['MODAL_TOKEN_SECRET']
|
166 |
-
except:
|
167 |
|
|
|
|
|
168 |
st.write("Loading secrets from environment variables")
|
169 |
api_key = os.environ['WEAVIATE_API_KEY']
|
170 |
url = os.environ['WEAVIATE_ENDPOINT']
|
|
|
143 |
data = load_data(data_path)
|
144 |
cache = None # load_content_cache(cache_path)
|
145 |
|
146 |
+
if isinstance(st.secrets, dict) and 'secrets' in st.secrets:
|
147 |
+
# for streamlit online or local, which uses a [secrets] section
|
148 |
+
Wapi_key = st.secrets['secrets']['WEAVIATE_API_KEY']
|
149 |
+
url = st.secrets['secrets']['WEAVIATE_ENDPOINT']
|
150 |
+
openai_api_key = st.secrets['secrets']['OPENAI_API_KEY']
|
151 |
+
|
152 |
+
hf_token = st.secrets['secrets']['LLAMA2_ENDPOINT_HF_TOKEN_chris']
|
153 |
+
hf_endpoint = st.secret['secrets']['LLAMA2_ENDPOINT_UPLIMIT']
|
154 |
+
model_token_id = st.secrets['secrets']['MODAL_TOKEN_ID']
|
155 |
+
modal_token_secret = st.secrets['secrets']['MODAL_TOKEN_SECRET']
|
156 |
+
|
157 |
+
elif isinstance(st.secrets, dict):
|
158 |
# for Huggingface (no [secrets] section)
|
159 |
Wapi_key = st.secrets['WEAVIATE_API_KEY']
|
160 |
url = st.secrets['WEAVIATE_ENDPOINT']
|
|
|
164 |
hf_endpoint = st.secrets['LLAMA2_ENDPOINT_UPLIMIT']
|
165 |
model_token_id = st.secrets['MODAL_TOKEN_ID']
|
166 |
modal_token_secret = st.secrets['MODAL_TOKEN_SECRET']
|
|
|
167 |
|
168 |
+
else:
|
169 |
+
# if we want to use env file
|
170 |
st.write("Loading secrets from environment variables")
|
171 |
api_key = os.environ['WEAVIATE_API_KEY']
|
172 |
url = os.environ['WEAVIATE_ENDPOINT']
|