omarelsayeed commited on
Commit
aecb855
·
verified ·
1 Parent(s): 555ccca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -11,7 +11,7 @@ import torch
11
  from transformers import LayoutLMv3ForTokenClassification
12
 
13
  # Load the LayoutLMv3 model
14
- layout_model = LayoutLMv3ForTokenClassification.from_pretrained("omarelsayeed/trial_simple_random_f")
15
 
16
  MAX_LEN = 100
17
  CLS_TOKEN_ID = 0
@@ -55,7 +55,6 @@ def parse_logits(logits: torch.Tensor, length: int) -> List[int]:
55
 
56
  def get_orders(image_path, boxes):
57
  b = scale_and_normalize_boxes(boxes)
58
- random.shuffle(b)
59
  inputs = boxes2inputs(b)
60
  inputs = {k: v.to(layout_model.device) for k, v in inputs.items()} # Move inputs to model device
61
  logits = layout_model(**inputs).logits.cpu().squeeze(0) # Perform inference and get logits
 
11
  from transformers import LayoutLMv3ForTokenClassification
12
 
13
  # Load the LayoutLMv3 model
14
+ layout_model = LayoutLMv3ForTokenClassification.from_pretrained("hantian/layoutreader")
15
 
16
  MAX_LEN = 100
17
  CLS_TOKEN_ID = 0
 
55
 
56
  def get_orders(image_path, boxes):
57
  b = scale_and_normalize_boxes(boxes)
 
58
  inputs = boxes2inputs(b)
59
  inputs = {k: v.to(layout_model.device) for k, v in inputs.items()} # Move inputs to model device
60
  logits = layout_model(**inputs).logits.cpu().squeeze(0) # Perform inference and get logits