asrilmurdian commited on
Commit
3a9ec04
1 Parent(s): f09b93a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -9,8 +9,12 @@ from transformers import pipeline
9
  import os
10
  from scholarly import scholarly
11
 
12
- # Set API key HuggingFace
13
- os.environ["HUGGING_FACE_API_KEY"] = os.environ.get("HF_TOKEN", None)
 
 
 
 
14
 
15
  # Definisi Tools
16
  def wikipedia_search(query):
 
9
  import os
10
  from scholarly import scholarly
11
 
12
+ hf_token = os.environ.get("HF_TOKEN", None)
13
+ if hf_token:
14
+ os.environ["HUGGING_FACE_API_KEY"] = hf_token
15
+ else:
16
+ st.error("Hugging Face API key is not set. Please set the HF_TOKEN environment variable.")
17
+ st.stop()
18
 
19
  # Definisi Tools
20
  def wikipedia_search(query):