Spaces:
Running
Running
Update helper.py
Browse files
helper.py
CHANGED
|
@@ -61,14 +61,16 @@ def summarize_predictions_natural_language(predictions):
|
|
| 61 |
result_string = "In this image, there are "
|
| 62 |
for i, (label, count) in enumerate(summary.items()):
|
| 63 |
count_string = p.number_to_words(count)
|
| 64 |
-
if i == 0
|
|
|
|
|
|
|
| 65 |
result_string += f"{count_string} {label}"
|
| 66 |
else:
|
| 67 |
-
result_string += f",{count_string} {label}"
|
| 68 |
if count > 1:
|
| 69 |
result_string += "s"
|
| 70 |
|
| 71 |
-
result_string += " "
|
| 72 |
|
| 73 |
if i == len(summary) - 2:
|
| 74 |
result_string += ", and "
|
|
|
|
| 61 |
result_string = "In this image, there are "
|
| 62 |
for i, (label, count) in enumerate(summary.items()):
|
| 63 |
count_string = p.number_to_words(count)
|
| 64 |
+
if i == 0:
|
| 65 |
+
result_string += f"{count_string} {label}"
|
| 66 |
+
elif i == len(summary) - 1:
|
| 67 |
result_string += f"{count_string} {label}"
|
| 68 |
else:
|
| 69 |
+
result_string += f", {count_string} {label}"
|
| 70 |
if count > 1:
|
| 71 |
result_string += "s"
|
| 72 |
|
| 73 |
+
#result_string += " "
|
| 74 |
|
| 75 |
if i == len(summary) - 2:
|
| 76 |
result_string += ", and "
|