pierreguillou commited on
Commit
2d1b7f0
1 Parent(s): fd53ed7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -36,6 +36,18 @@ from functions import *
36
  # update pip
37
  os.system('python -m pip install --upgrade pip')
38
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  # APP outputs
40
  def app_outputs(uploaded_pdf):
41
  filename, msg, images = pdf_to_images(uploaded_pdf)
 
36
  # update pip
37
  os.system('python -m pip install --upgrade pip')
38
 
39
+ # model
40
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
41
+
42
+ import torch
43
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
44
+
45
+ model_id = "pierreguillou/lilt-xlm-roberta-base-finetuned-with-DocLayNet-base-at-linelevel-ml384"
46
+
47
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
48
+ model = AutoModelForTokenClassification.from_pretrained(model_id);
49
+ model.to(device);
50
+
51
  # APP outputs
52
  def app_outputs(uploaded_pdf):
53
  filename, msg, images = pdf_to_images(uploaded_pdf)