cordwainersmith commited on
Commit
5d89fbb
1 Parent(s): c0b37e0
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -66,9 +66,13 @@ MODEL_DETAILS = {
66
  class PIIMaskingModel:
67
  def __init__(self, model_name: str):
68
  self.model_name = model_name
69
- self.tokenizer = AutoTokenizer.from_pretrained(model_name)
70
- self.model = AutoModelForTokenClassification.from_pretrained(model_name)
71
- # No need to specify device as we are forcing CPU usage
 
 
 
 
72
 
73
  def process_text(
74
  self, text: str
 
66
  class PIIMaskingModel:
67
  def __init__(self, model_name: str):
68
  self.model_name = model_name
69
+ hf_token = st.secrets["HF_TOKEN"] # Retrieve the token from secrets
70
+ self.tokenizer = AutoTokenizer.from_pretrained(
71
+ model_name, use_auth_token=hf_token
72
+ )
73
+ self.model = AutoModelForTokenClassification.from_pretrained(
74
+ model_name, use_auth_token=hf_token
75
+ )
76
 
77
  def process_text(
78
  self, text: str