AamerAkhter commited on
Commit
0b1355c
·
verified ·
1 Parent(s): 15e8eb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 = "MY_API_KEY"
10
 
11
  try:
12
  # Check if the key exists in secrets
13
  if SECRET_KEY_NAME in st.secrets:
14
- api_key = st.secrets[SECRET_KEY_NAME]
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 `{SECRET_KEY_NAME}` not found.")
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**.