omarelsayeed commited on
Commit
69dd8ab
1 Parent(s): db9f08e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -4,7 +4,7 @@ from huggingface_hub import snapshot_download
4
  from PIL import Image
5
  from PIL import Image, ImageDraw, ImageFont
6
 
7
-
8
  from collections import defaultdict
9
  from typing import List, Dict
10
  import torch
@@ -55,6 +55,7 @@ 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
  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
 
4
  from PIL import Image
5
  from PIL import Image, ImageDraw, ImageFont
6
 
7
+ import random
8
  from collections import defaultdict
9
  from typing import List, Dict
10
  import torch
 
55
 
56
  def get_orders(image_path, boxes):
57
  b = scale_and_normalize_boxes(boxes)
58
+ b = 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