JuanPablo4to commited on
Commit
c897f8f
·
verified ·
1 Parent(s): e2374a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -3,9 +3,11 @@ import os
3
  from transformers import pipeline
4
  from huggingface_hub import login
5
 
6
- # Set your Hugging Face API token
7
- api_token =
8
- os.environ["HUGGINGFACE_HUB_TOKEN"] = api_token
 
 
9
 
10
  # Login using your Hugging Face token
11
  login(token=api_token)
 
3
  from transformers import pipeline
4
  from huggingface_hub import login
5
 
6
+ # Read the Hugging Face API token from the environment variable
7
+ api_token = os.getenv("HF_API_TOKEN")
8
+ if not api_token:
9
+ st.error("Hugging Face API token is missing. Please add it to the secrets in the Space settings.")
10
+ st.stop()
11
 
12
  # Login using your Hugging Face token
13
  login(token=api_token)