Spaces:
Sleeping
Sleeping
Update cord_inference.py
Browse files- cord_inference.py +3 -4
cord_inference.py
CHANGED
@@ -94,11 +94,9 @@ def prediction(image):
|
|
94 |
true_words = true_words[1:-1]
|
95 |
true_confidence_scores = true_confidence_scores[1:-1]
|
96 |
|
97 |
-
"""
|
98 |
for i, conf in enumerate(true_confidence_scores):
|
99 |
-
if conf < 0.
|
100 |
-
true_predictions[i] = "O"
|
101 |
-
"""
|
102 |
|
103 |
d = {}
|
104 |
for id, i in enumerate(true_predictions):
|
@@ -107,6 +105,7 @@ def prediction(image):
|
|
107 |
else:
|
108 |
d[i] = d[i] + ", " + true_words[id]
|
109 |
d = {k: v.strip() for (k, v) in d.items()}
|
|
|
110 |
|
111 |
# TODO:process the json
|
112 |
|
|
|
94 |
true_words = true_words[1:-1]
|
95 |
true_confidence_scores = true_confidence_scores[1:-1]
|
96 |
|
|
|
97 |
for i, conf in enumerate(true_confidence_scores):
|
98 |
+
if conf < 0.6 :
|
99 |
+
true_predictions[i] = "O"
|
|
|
100 |
|
101 |
d = {}
|
102 |
for id, i in enumerate(true_predictions):
|
|
|
105 |
else:
|
106 |
d[i] = d[i] + ", " + true_words[id]
|
107 |
d = {k: v.strip() for (k, v) in d.items()}
|
108 |
+
d.pop("O")
|
109 |
|
110 |
# TODO:process the json
|
111 |
|