Spaces:
Build error
Build error
Update app/tapas.py
Browse files- app/tapas.py +10 -10
app/tapas.py
CHANGED
@@ -65,16 +65,16 @@ def postprocess_predictions(predicted_aggregation_operators, predicted_table_cel
|
|
65 |
# Process predicted table cell coordinates
|
66 |
answers = []
|
67 |
for agg, coordinates in zip(predicted_aggregation_operators, predicted_table_cell_coords):
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
# Return values
|
79 |
return aggregation_predictions_string, answers
|
80 |
|
|
|
65 |
# Process predicted table cell coordinates
|
66 |
answers = []
|
67 |
for agg, coordinates in zip(predicted_aggregation_operators, predicted_table_cell_coords):
|
68 |
+
if len(coordinates) == 1:
|
69 |
+
# 1 cell
|
70 |
+
answers.append(table.iat[coordinates[0]])
|
71 |
+
else:
|
72 |
+
# > 1 cell
|
73 |
+
cell_values = []
|
74 |
+
for coordinate in coordinates:
|
75 |
+
cell_values.append(table.iat[coordinate])
|
76 |
+
answers.append(", ".join(cell_values))
|
77 |
+
|
78 |
# Return values
|
79 |
return aggregation_predictions_string, answers
|
80 |
|