João Pedro commited on
Commit
9652b01
·
1 Parent(s): 2bc05a3

revert back to using pre-trained layoutlm

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -14,10 +14,26 @@ if not wandb_api_key:
14
  else:
15
  wandb.login(key=wandb_api_key)
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  processor = LayoutLMv3Processor.from_pretrained("model/layoutlmv3/")
18
  model = LayoutLMv3ForSequenceClassification.from_pretrained("model/layoutlmv3/")
19
- id2label = model.config.id2label
20
- label2id = model.config.label2id
21
 
22
  st.title("Document Classification with LayoutLMv3")
23
 
 
14
  else:
15
  wandb.login(key=wandb_api_key)
16
 
17
+ labels = [
18
+ 'budget',
19
+ 'email',
20
+ 'form',
21
+ 'handwritten',
22
+ 'invoice',
23
+ 'language',
24
+ 'letter',
25
+ 'memo',
26
+ 'news article',
27
+ 'questionnaire',
28
+ 'resume',
29
+ 'scientific publication',
30
+ 'specification',
31
+ ]
32
+ id2label = {i: label for i, label in enumerate(labels)}
33
+ label2id = {v: k for k, v in id2label.items()}
34
+
35
  processor = LayoutLMv3Processor.from_pretrained("model/layoutlmv3/")
36
  model = LayoutLMv3ForSequenceClassification.from_pretrained("model/layoutlmv3/")
 
 
37
 
38
  st.title("Document Classification with LayoutLMv3")
39