TDN-M commited on
Commit
9fe1456
1 Parent(s): ab23d27
Files changed (2) hide show
  1. app.py +4 -5
  2. requirements.txt +2 -1
app.py CHANGED
@@ -7,14 +7,13 @@ from docx import Document
7
  from docx.shared import Pt
8
  from docx.oxml.ns import qn
9
 
10
- # Thiết lập token API từ Hugging Face
11
- import os
12
- os.environ["HUGGINGFACEHUB_API_TOKEN"] = "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"
13
 
14
  # Tải mô hình và tokenizer từ Hugging Face
15
  model_name = "meta-llama/Meta-Llama-3.1-8B-Instruct"
16
- tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=True)
17
- model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, use_auth_token=True).to("cuda")
18
 
19
  def analyze_chat(link, extraction_request, system_message, max_tokens, temperature, top_p):
20
  response = requests.get(link)
 
7
  from docx.shared import Pt
8
  from docx.oxml.ns import qn
9
 
10
+ # Thiết lập API token từ Hugging Face
11
+ api_token = "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"
 
12
 
13
  # Tải mô hình và tokenizer từ Hugging Face
14
  model_name = "meta-llama/Meta-Llama-3.1-8B-Instruct"
15
+ tokenizer = AutoTokenizer.from_pretrained(model_name, token=api_token)
16
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, token=api_token).to("cuda")
17
 
18
  def analyze_chat(link, extraction_request, system_message, max_tokens, temperature, top_p):
19
  response = requests.get(link)
requirements.txt CHANGED
@@ -2,4 +2,5 @@ gradio
2
  transformers
3
  requests
4
  pdfkit
5
- python-docx
 
 
2
  transformers
3
  requests
4
  pdfkit
5
+ python-docx
6
+ numpy==1.21.0