jonACE commited on
Commit
015e26a
·
verified ·
1 Parent(s): e222a9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -14,9 +14,17 @@ def preprocess_text(text):
14
  pdf_text = extract_text_from_pdf("new-american-standard-bible.pdf")
15
  clean_text = preprocess_text(pdf_text)
16
 
17
- #from huggingface_hub import login
 
18
 
19
- #login(token="") # Get token from https://huggingface.co/settings/tokens
 
 
 
 
 
 
 
20
 
21
  from datasets import Dataset
22
  from transformers import AutoTokenizer
 
14
  pdf_text = extract_text_from_pdf("new-american-standard-bible.pdf")
15
  clean_text = preprocess_text(pdf_text)
16
 
17
+ import os
18
+ from huggingface_hub import login
19
 
20
+ # Read the Hugging Face token from environment variables
21
+ hf_token = os.getenv("access_token")
22
+
23
+ if hf_token is None:
24
+ raise ValueError("'access_token' is not set. Add it as a secret variable in Hugging Face Spaces.")
25
+
26
+ # Log in to Hugging Face
27
+ login(token=hf_token)
28
 
29
  from datasets import Dataset
30
  from transformers import AutoTokenizer