pierreguillou commited on
Commit
ed9f2e9
1 Parent(s): ea1aefa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -80,6 +80,15 @@ feature_extractor = LayoutLMv2FeatureExtractor(apply_ocr=False)
80
  from transformers import AutoTokenizer
81
  tokenizer_layoutxlm = AutoTokenizer.from_pretrained(tokenizer_id_layoutxlm)
82
 
 
 
 
 
 
 
 
 
 
83
  # APP outputs by model
84
  def app_outputs_by_model(uploaded_pdf, model_id, model, tokenizer, max_length, id2label, cls_box, sep_box):
85
  filename, msg, images = pdf_to_images(uploaded_pdf)
 
80
  from transformers import AutoTokenizer
81
  tokenizer_layoutxlm = AutoTokenizer.from_pretrained(tokenizer_id_layoutxlm)
82
 
83
+ # get labels
84
+ id2label_lilt = model_lilt.config.id2label
85
+ label2id_lilt = model_lilt.config.label2id
86
+ num_labels_lilt = len(id2label_lilt)
87
+
88
+ id2label_layoutxlm = model_layoutxlm.config.id2label
89
+ label2id_layoutxlm = model_layoutxlm.config.label2id
90
+ num_labels_layoutxlm = len(id2label_layoutxlm)
91
+
92
  # APP outputs by model
93
  def app_outputs_by_model(uploaded_pdf, model_id, model, tokenizer, max_length, id2label, cls_box, sep_box):
94
  filename, msg, images = pdf_to_images(uploaded_pdf)