acecalisto3 commited on
Commit
508645e
1 Parent(s): 33cb0e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -10,15 +10,16 @@ import streamlit as st
10
  from transformers import pipeline, AutoModelForSeq2SeqLM, AutoTokenizer
11
  from pylint import lint
12
 
13
- # Add your Hugging Face API token here
14
- hf_token = st.secrets["huggingface"]["api_key"]
15
- # Accessing the secret
16
- try:
17
- hf_token = st.secrets["huggingface"]["api_key"]
18
- except KeyError:
19
- st.error("Hugging Face API key not found. Please configure it in your secrets.")
20
  st.stop()
21
 
 
 
 
22
  # Rest of your code here
23
  st.write("Hugging Face API key successfully loaded!")
24
  # Global state to manage communication between Tool Box and Workspace Chat App
 
10
  from transformers import pipeline, AutoModelForSeq2SeqLM, AutoTokenizer
11
  from pylint import lint
12
 
13
+ # Replace st.secrets with os.environ
14
+ hf_token = os.environ.get("huggingface_token")
15
+
16
+ if not hf_token:
17
+ st.error("Hugging Face API key not found. Please set the HUGGINGFACE_API_KEY environment variable.")
 
 
18
  st.stop()
19
 
20
+ # Rest of your code here
21
+ st.write("Hugging Face API key successfully loaded!")
22
+
23
  # Rest of your code here
24
  st.write("Hugging Face API key successfully loaded!")
25
  # Global state to manage communication between Tool Box and Workspace Chat App