acecalisto3 commited on
Commit
23ef007
1 Parent(s): d1a1a6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -11,8 +11,16 @@ 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"]
15
-
 
 
 
 
 
 
 
 
16
  # Global state to manage communication between Tool Box and Workspace Chat App
17
  if "chat_history" not in st.session_state:
18
  st.session_state.chat_history = []
 
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
25
  if "chat_history" not in st.session_state:
26
  st.session_state.chat_history = []