pierreguillou commited on
Commit
b05819d
1 Parent(s): 9c8291e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -52,13 +52,14 @@ os.system('python -m pip install --upgrade pip')
52
 
53
  ## model / feature extractor / tokenizer
54
 
55
- from transformers import LayoutLMv2ForTokenClassification # LayoutXLMTokenizerFast,
56
-
57
  import torch
58
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
59
 
60
  # model
61
- # tokenizer = LayoutXLMTokenizerFast.from_pretrained(model_id)
 
 
 
62
  model = LayoutLMv2ForTokenClassification.from_pretrained(model_id);
63
  model.to(device);
64
 
@@ -68,6 +69,7 @@ feature_extractor = LayoutLMv2FeatureExtractor(apply_ocr=False)
68
 
69
  # tokenizer
70
  from transformers import AutoTokenizer
 
71
  tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
72
 
73
  # APP outputs
 
52
 
53
  ## model / feature extractor / tokenizer
54
 
 
 
55
  import torch
56
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
57
 
58
  # model
59
+ from transformers import LayoutLMv2ForTokenClassification
60
+
61
+ model_id = "pierreguillou/layout-xlm-base-finetuned-with-DocLayNet-base-at-linelevel-ml384"
62
+
63
  model = LayoutLMv2ForTokenClassification.from_pretrained(model_id);
64
  model.to(device);
65
 
 
69
 
70
  # tokenizer
71
  from transformers import AutoTokenizer
72
+ tokenizer_id = "xlm-roberta-base"
73
  tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
74
 
75
  # APP outputs