Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -293,10 +293,14 @@ def display_dishes_in_grid(dishes, cols=3):
|
|
| 293 |
|
| 294 |
def display_prediction_graph(class_names, confidences):
|
| 295 |
# Create a list of labels and values from the predictions dictionary
|
| 296 |
-
values = [round(value, 1) + "%" for value in confidences]
|
|
|
|
|
|
|
|
|
|
| 297 |
|
| 298 |
# Determine the top prediction
|
| 299 |
class_names.reverse()
|
|
|
|
| 300 |
values.reverse()
|
| 301 |
top_prediction = class_names[-1]
|
| 302 |
|
|
|
|
| 293 |
|
| 294 |
def display_prediction_graph(class_names, confidences):
|
| 295 |
# Create a list of labels and values from the predictions dictionary
|
| 296 |
+
values = [str(round(value, 1)) + "%" for value in confidences]
|
| 297 |
+
|
| 298 |
+
# Wrap class names if they are too long
|
| 299 |
+
class_names = [textwrap.fill(class_name, width=10) for class_name in class_names]
|
| 300 |
|
| 301 |
# Determine the top prediction
|
| 302 |
class_names.reverse()
|
| 303 |
+
# Determine the top prediction
|
| 304 |
values.reverse()
|
| 305 |
top_prediction = class_names[-1]
|
| 306 |
|