Spaces:
Build error
Build error
Update sroie_inference.py
Browse files- sroie_inference.py +7 -7
sroie_inference.py
CHANGED
|
@@ -71,9 +71,9 @@ def prediction(image):
|
|
| 71 |
true_words = true_words[1:-1]
|
| 72 |
true_confidence_scores = true_confidence_scores[1:-1]
|
| 73 |
|
| 74 |
-
for i, j in enumerate(true_confidence_scores):
|
| 75 |
-
|
| 76 |
-
|
| 77 |
|
| 78 |
d = {}
|
| 79 |
for id, i in enumerate(true_predictions):
|
|
@@ -94,11 +94,11 @@ def prediction(image):
|
|
| 94 |
image = (blur(image, blur_boxes))
|
| 95 |
|
| 96 |
#draw = ImageDraw.Draw(image, "RGBA")
|
| 97 |
-
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
|
| 103 |
return d, image
|
| 104 |
|
|
|
|
| 71 |
true_words = true_words[1:-1]
|
| 72 |
true_confidence_scores = true_confidence_scores[1:-1]
|
| 73 |
|
| 74 |
+
#for i, j in enumerate(true_confidence_scores):
|
| 75 |
+
# if j < 0.8: #####################################
|
| 76 |
+
# true_predictions[i] = "O"
|
| 77 |
|
| 78 |
d = {}
|
| 79 |
for id, i in enumerate(true_predictions):
|
|
|
|
| 94 |
image = (blur(image, blur_boxes))
|
| 95 |
|
| 96 |
#draw = ImageDraw.Draw(image, "RGBA")
|
| 97 |
+
font = ImageFont.load_default()
|
| 98 |
|
| 99 |
+
for prediction, box in zip(preds, bboxes):
|
| 100 |
+
draw.rectangle(box)
|
| 101 |
+
draw.text((box[0]+10, box[1]-10), text=prediction, font=font, fill="black", font_size="8")
|
| 102 |
|
| 103 |
return d, image
|
| 104 |
|