Spaces:
Running
Running
modifications for secrets on HF
Browse files
app.py
CHANGED
@@ -154,13 +154,24 @@ try:
|
|
154 |
# st.write("Secrets loaded from secrets.toml")
|
155 |
# st.write("HF_TOKEN", hf_token)
|
156 |
except:
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
#%%
|
165 |
# model_default = 'sentence-transformers/all-mpnet-base-v2'
|
166 |
model_default = 'models/finetuned-all-mpnet-base-v2-300' if we_are_not_online \
|
|
|
154 |
# st.write("Secrets loaded from secrets.toml")
|
155 |
# st.write("HF_TOKEN", hf_token)
|
156 |
except:
|
157 |
+
try:
|
158 |
+
# for Huggingface (no [secrets] section)
|
159 |
+
Wapi_key = st.secrets['WEAVIATE_API_KEY']
|
160 |
+
url = st.secrets['WEAVIATE_ENDPOINT']
|
161 |
+
openai_api_key = st.secrets['OPENAI_API_KEY']
|
162 |
+
|
163 |
+
hf_token = st.secrets['LLAMA2_ENDPOINT_HF_TOKEN_chris']
|
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 |
+
except:
|
168 |
+
st.write("Loading secrets from environment variables")
|
169 |
+
api_key = os.environ['WEAVIATE_API_KEY']
|
170 |
+
url = os.environ['WEAVIATE_ENDPOINT']
|
171 |
+
openai_api_key = os.environ['OPENAI_API_KEY']
|
172 |
+
|
173 |
+
hf_token = os.environ['LLAMA2_ENDPOINT_HF_TOKEN_chris']
|
174 |
+
hf_endpoint = os.environ['LLAMA2_ENDPOINT_UPLIMIT']
|
175 |
#%%
|
176 |
# model_default = 'sentence-transformers/all-mpnet-base-v2'
|
177 |
model_default = 'models/finetuned-all-mpnet-base-v2-300' if we_are_not_online \
|