mp-02 commited on
Commit
f88cfb3
·
verified ·
1 Parent(s): a3a5528

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +4 -1
inference.py CHANGED
@@ -36,7 +36,7 @@ def create_json_output(words, labels, boxes):
36
  json_output = json.dumps(output, indent=4)
37
  return json_output
38
 
39
- def prediction()
40
 
41
  boxes, words = OCR(image)
42
  # Preprocessa l'immagine e il testo con il processore di LayoutLMv3
@@ -56,6 +56,9 @@ def prediction()
56
  confidence_scores = probabilities.max(-1).values.squeeze().tolist()
57
  # Crea il JSON usando i risultati ottenuti
58
  json_result = create_json_output(words, labels, boxes)
 
 
 
59
 
60
  for prediction, box, confidence in zip(true_predictions, true_boxes, true_confidence_scores):
61
  draw.rectangle(box)
 
36
  json_output = json.dumps(output, indent=4)
37
  return json_output
38
 
39
+ def prediction(Image image)
40
 
41
  boxes, words = OCR(image)
42
  # Preprocessa l'immagine e il testo con il processore di LayoutLMv3
 
56
  confidence_scores = probabilities.max(-1).values.squeeze().tolist()
57
  # Crea il JSON usando i risultati ottenuti
58
  json_result = create_json_output(words, labels, boxes)
59
+
60
+ draw = ImageDraw.Draw(image, "RGBA")
61
+ font = ImageFont.load_default()
62
 
63
  for prediction, box, confidence in zip(true_predictions, true_boxes, true_confidence_scores):
64
  draw.rectangle(box)