Spaces:
Sleeping
Sleeping
adapted secrets to HF
Browse files
app.py
CHANGED
@@ -144,34 +144,34 @@ data = load_data(data_path)
|
|
144 |
cache = None # load_content_cache(cache_path)
|
145 |
|
146 |
try:
|
147 |
-
# st.write("Loading secrets from secrets.toml")
|
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.secrets['secrets']['LLAMA2_ENDPOINT_UPLIMIT']
|
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_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 \
|
|
|
144 |
cache = None # load_content_cache(cache_path)
|
145 |
|
146 |
try:
|
147 |
+
# # st.write("Loading secrets from secrets.toml")
|
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.secrets['secrets']['LLAMA2_ENDPOINT_UPLIMIT']
|
154 |
+
# # st.write("Secrets loaded from secrets.toml")
|
155 |
+
# # st.write("HF_TOKEN", hf_token)
|
156 |
+
|
157 |
+
# for Huggingface (no [secrets] section)
|
158 |
+
Wapi_key = st.secrets['WEAVIATE_API_KEY']
|
159 |
+
url = st.secrets['WEAVIATE_ENDPOINT']
|
160 |
+
openai_api_key = st.secrets['OPENAI_API_KEY']
|
161 |
+
|
162 |
+
hf_token = st.secrets['LLAMA2_ENDPOINT_HF_TOKEN_chris']
|
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']
|
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 \
|