Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,12 +6,12 @@ def main():
|
|
| 6 |
# On Hugging Face Spaces, go to 'Settings' > 'Variables and secrets' to add your key.
|
| 7 |
# In Streamlit, these are accessible via st.secrets
|
| 8 |
|
| 9 |
-
SECRET_KEY_NAME = "
|
| 10 |
|
| 11 |
try:
|
| 12 |
# Check if the key exists in secrets
|
| 13 |
if SECRET_KEY_NAME in st.secrets:
|
| 14 |
-
api_key = st.secrets[
|
| 15 |
|
| 16 |
st.success(f"Successfully loaded secret: `{SECRET_KEY_NAME}`")
|
| 17 |
|
|
@@ -22,7 +22,7 @@ def main():
|
|
| 22 |
st.info("You can now use this variable `api_key` to make authenticated requests.")
|
| 23 |
|
| 24 |
else:
|
| 25 |
-
st.warning(f"Secret `{
|
| 26 |
st.markdown("""
|
| 27 |
**How to fix:**
|
| 28 |
1. Go to your Hugging Face Space **Settings**.
|
|
|
|
| 6 |
# On Hugging Face Spaces, go to 'Settings' > 'Variables and secrets' to add your key.
|
| 7 |
# In Streamlit, these are accessible via st.secrets
|
| 8 |
|
| 9 |
+
SECRET_KEY_NAME = "MY_NEW_SECRET"
|
| 10 |
|
| 11 |
try:
|
| 12 |
# Check if the key exists in secrets
|
| 13 |
if SECRET_KEY_NAME in st.secrets:
|
| 14 |
+
api_key = st.secrets[MY_NEW_SECRET]
|
| 15 |
|
| 16 |
st.success(f"Successfully loaded secret: `{SECRET_KEY_NAME}`")
|
| 17 |
|
|
|
|
| 22 |
st.info("You can now use this variable `api_key` to make authenticated requests.")
|
| 23 |
|
| 24 |
else:
|
| 25 |
+
st.warning(f"Secret `{MY_NEW_SECRET}` not found.")
|
| 26 |
st.markdown("""
|
| 27 |
**How to fix:**
|
| 28 |
1. Go to your Hugging Face Space **Settings**.
|