mp-02 commited on
Commit
80ff823
·
verified ·
1 Parent(s): 7300f19

Update cord_inference.py

Browse files
Files changed (1) hide show
  1. cord_inference.py +2 -4
cord_inference.py CHANGED
@@ -55,12 +55,10 @@ def prediction(image):
55
  true_words = true_words[1:-1]
56
  true_confidence_scores = true_confidence_scores[1:-1]
57
 
58
- preds = []
59
  l_words = []
60
- bboxes = []
61
 
62
  d = {}
63
- for id, i in enumerate(preds):
64
  if i not in d.keys():
65
  d[i] = l_words[id]
66
  else:
@@ -72,7 +70,7 @@ def prediction(image):
72
  draw = ImageDraw.Draw(image, "RGBA")
73
  font = ImageFont.load_default()
74
 
75
- for prediction, box, confidence in zip(preds, bboxes, true_confidence_scores):
76
  draw.rectangle(box)
77
  draw.text((box[0]+10, box[1]-10), text=prediction+ ", "+ confidence, font=font, fill="black", font_size="15")
78
 
 
55
  true_words = true_words[1:-1]
56
  true_confidence_scores = true_confidence_scores[1:-1]
57
 
 
58
  l_words = []
 
59
 
60
  d = {}
61
+ for id, i in enumerate(true_predictions):
62
  if i not in d.keys():
63
  d[i] = l_words[id]
64
  else:
 
70
  draw = ImageDraw.Draw(image, "RGBA")
71
  font = ImageFont.load_default()
72
 
73
+ for prediction, box, confidence in zip(true_predictions, true_boxes, true_confidence_scores):
74
  draw.rectangle(box)
75
  draw.text((box[0]+10, box[1]-10), text=prediction+ ", "+ confidence, font=font, fill="black", font_size="15")
76