Dhahlan2000 commited on
Commit
9b0e653
·
1 Parent(s): d8aeb3b

Update app.py to replace 'token' with 'API_KEY' in environment variable retrieval and adjust model/tokenizer initialization to use 'use_auth_token' for compatibility with Hugging Face's latest API changes. This ensures proper authentication handling when loading the model and tokenizer.

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -31,14 +31,14 @@ def extract_cv_text(file):
31
  return "Unsupported file format. Please upload PDF or DOCX files."
32
 
33
  # Replace 'your_huggingface_token' with your actual Hugging Face access token
34
- access_token = os.getenv('token')
35
 
36
  # Initialize the tokenizer and model with the Hugging Face access token
37
- tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it", token=access_token)
38
  model = AutoModelForCausalLM.from_pretrained(
39
  "google/gemma-2b-it",
40
  torch_dtype=torch.bfloat16,
41
- token=access_token
42
  )
43
  model.eval() # Set the model to evaluation mode
44
 
 
31
  return "Unsupported file format. Please upload PDF or DOCX files."
32
 
33
  # Replace 'your_huggingface_token' with your actual Hugging Face access token
34
+ access_token = os.getenv('API_KEY')
35
 
36
  # Initialize the tokenizer and model with the Hugging Face access token
37
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it", use_auth_token=access_token)
38
  model = AutoModelForCausalLM.from_pretrained(
39
  "google/gemma-2b-it",
40
  torch_dtype=torch.bfloat16,
41
+ use_auth_token=access_token
42
  )
43
  model.eval() # Set the model to evaluation mode
44