Join task_id and index, smaller prediction col width
Browse files- app.py +27 -29
- views/predictions_view.py +12 -4
app.py
CHANGED
|
@@ -37,11 +37,6 @@ body {
|
|
| 37 |
word-break: break-word;
|
| 38 |
overflow-wrap: anywhere;
|
| 39 |
}
|
| 40 |
-
#predictions-table table td:nth-child(6),
|
| 41 |
-
#predictions-table table th:nth-child(6) {
|
| 42 |
-
max-width: 24rem;
|
| 43 |
-
width: 24rem;
|
| 44 |
-
}
|
| 45 |
#predictions-table table td:nth-child(1),
|
| 46 |
#predictions-table table th:nth-child(1) {
|
| 47 |
min-width: 7rem;
|
|
@@ -49,42 +44,45 @@ body {
|
|
| 49 |
}
|
| 50 |
#predictions-table table td:nth-child(2),
|
| 51 |
#predictions-table table th:nth-child(2) {
|
| 52 |
-
min-width: 5rem;
|
| 53 |
-
width: 5rem;
|
| 54 |
-
}
|
| 55 |
-
#predictions-table table td:nth-child(8),
|
| 56 |
-
#predictions-table table th:nth-child(8) {
|
| 57 |
-
min-width: 28rem;
|
| 58 |
-
width: 28rem;
|
| 59 |
-
}
|
| 60 |
-
#predictions-table table td:nth-child(7),
|
| 61 |
-
#predictions-table table th:nth-child(7) {
|
| 62 |
-
min-width: 14rem;
|
| 63 |
-
width: 14rem;
|
| 64 |
-
}
|
| 65 |
-
#predictions-table table td:nth-child(9),
|
| 66 |
-
#predictions-table table th:nth-child(9) {
|
| 67 |
-
min-width: 5rem;
|
| 68 |
-
width: 5rem;
|
| 69 |
-
}
|
| 70 |
-
#predictions-table table td:nth-child(3),
|
| 71 |
-
#predictions-table table th:nth-child(3) {
|
| 72 |
min-width: 8rem;
|
| 73 |
width: 8rem;
|
|
|
|
|
|
|
| 74 |
}
|
| 75 |
-
#predictions-table table td:nth-child(
|
| 76 |
display: block;
|
|
|
|
| 77 |
max-width: 7rem;
|
| 78 |
max-height: 7rem;
|
| 79 |
object-fit: contain;
|
| 80 |
}
|
|
|
|
|
|
|
| 81 |
#predictions-table table td:nth-child(4),
|
| 82 |
-
#predictions-table table th:nth-child(4)
|
| 83 |
-
#predictions-table table td:nth-child(5),
|
| 84 |
-
#predictions-table table th:nth-child(5) {
|
| 85 |
min-width: 10rem;
|
| 86 |
width: 10rem;
|
| 87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
"""
|
| 89 |
LEADERBOARD_SPLITS = ("test", "validation")
|
| 90 |
RESULTS_REPO = os.getenv("RESULTS_REPO", "NASK-PIB/PoVisLE-results")
|
|
|
|
| 37 |
word-break: break-word;
|
| 38 |
overflow-wrap: anywhere;
|
| 39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
#predictions-table table td:nth-child(1),
|
| 41 |
#predictions-table table th:nth-child(1) {
|
| 42 |
min-width: 7rem;
|
|
|
|
| 44 |
}
|
| 45 |
#predictions-table table td:nth-child(2),
|
| 46 |
#predictions-table table th:nth-child(2) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
min-width: 8rem;
|
| 48 |
width: 8rem;
|
| 49 |
+
text-align: center;
|
| 50 |
+
vertical-align: middle;
|
| 51 |
}
|
| 52 |
+
#predictions-table table td:nth-child(2) img.prediction-image {
|
| 53 |
display: block;
|
| 54 |
+
margin: 0 auto;
|
| 55 |
max-width: 7rem;
|
| 56 |
max-height: 7rem;
|
| 57 |
object-fit: contain;
|
| 58 |
}
|
| 59 |
+
#predictions-table table td:nth-child(3),
|
| 60 |
+
#predictions-table table th:nth-child(3),
|
| 61 |
#predictions-table table td:nth-child(4),
|
| 62 |
+
#predictions-table table th:nth-child(4) {
|
|
|
|
|
|
|
| 63 |
min-width: 10rem;
|
| 64 |
width: 10rem;
|
| 65 |
}
|
| 66 |
+
#predictions-table table td:nth-child(5),
|
| 67 |
+
#predictions-table table th:nth-child(5) {
|
| 68 |
+
max-width: 24rem;
|
| 69 |
+
width: 24rem;
|
| 70 |
+
}
|
| 71 |
+
#predictions-table table td:nth-child(6),
|
| 72 |
+
#predictions-table table th:nth-child(6) {
|
| 73 |
+
min-width: 14rem;
|
| 74 |
+
width: 14rem;
|
| 75 |
+
}
|
| 76 |
+
#predictions-table table td:nth-child(7),
|
| 77 |
+
#predictions-table table th:nth-child(7) {
|
| 78 |
+
min-width: 20rem;
|
| 79 |
+
width: 20rem;
|
| 80 |
+
}
|
| 81 |
+
#predictions-table table td:nth-child(8),
|
| 82 |
+
#predictions-table table th:nth-child(8) {
|
| 83 |
+
min-width: 5rem;
|
| 84 |
+
width: 5rem;
|
| 85 |
+
}
|
| 86 |
"""
|
| 87 |
LEADERBOARD_SPLITS = ("test", "validation")
|
| 88 |
RESULTS_REPO = os.getenv("RESULTS_REPO", "NASK-PIB/PoVisLE-results")
|
views/predictions_view.py
CHANGED
|
@@ -8,8 +8,7 @@ ALL_OPTION = "All"
|
|
| 8 |
NO_SUBCATEGORY_OPTION = "No subcategory"
|
| 9 |
TASK_TYPE_OPTIONS = ["mcq", "yes/no", "open"]
|
| 10 |
PREDICTION_COLUMNS = [
|
| 11 |
-
"
|
| 12 |
-
"index",
|
| 13 |
"image",
|
| 14 |
"category",
|
| 15 |
"subcategory",
|
|
@@ -18,7 +17,7 @@ PREDICTION_COLUMNS = [
|
|
| 18 |
"prediction",
|
| 19 |
"score",
|
| 20 |
]
|
| 21 |
-
PREDICTION_DATATYPES = ["str", "
|
| 22 |
TASK_TYPE_LABELS = {
|
| 23 |
"mcq": "mcq",
|
| 24 |
"yn": "yes/no",
|
|
@@ -55,6 +54,10 @@ def normalize_task_type(value: object) -> str:
|
|
| 55 |
return TASK_TYPE_LABELS.get(value.strip().lower(), value.strip().lower())
|
| 56 |
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
def category_options(predictions_df: pd.DataFrame) -> list[str]:
|
| 59 |
if predictions_df.empty:
|
| 60 |
return [ALL_OPTION]
|
|
@@ -108,9 +111,14 @@ def filter_predictions(
|
|
| 108 |
filtered["prompt"] = filtered["prompt"].map(normalize_prompt)
|
| 109 |
filtered["prompt"] = filtered["prompt"].map(compact_prompt)
|
| 110 |
filtered["processed_prediction"] = filtered["processed_prediction"].map(shorten_prediction)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
filtered = filtered.rename(columns={"processed_prediction": "prediction"})
|
|
|
|
| 112 |
filtered = filtered[PREDICTION_COLUMNS]
|
| 113 |
-
return filtered.
|
| 114 |
|
| 115 |
|
| 116 |
def render_predictions_tab(predictions_df: pd.DataFrame) -> None:
|
|
|
|
| 8 |
NO_SUBCATEGORY_OPTION = "No subcategory"
|
| 9 |
TASK_TYPE_OPTIONS = ["mcq", "yes/no", "open"]
|
| 10 |
PREDICTION_COLUMNS = [
|
| 11 |
+
"task",
|
|
|
|
| 12 |
"image",
|
| 13 |
"category",
|
| 14 |
"subcategory",
|
|
|
|
| 17 |
"prediction",
|
| 18 |
"score",
|
| 19 |
]
|
| 20 |
+
PREDICTION_DATATYPES = ["str", "html", "str", "str", "str", "str", "str", "number"]
|
| 21 |
TASK_TYPE_LABELS = {
|
| 22 |
"mcq": "mcq",
|
| 23 |
"yn": "yes/no",
|
|
|
|
| 54 |
return TASK_TYPE_LABELS.get(value.strip().lower(), value.strip().lower())
|
| 55 |
|
| 56 |
|
| 57 |
+
def format_task_ref(task_id: object, index: object) -> str:
|
| 58 |
+
return f"{task_id}/{index}"
|
| 59 |
+
|
| 60 |
+
|
| 61 |
def category_options(predictions_df: pd.DataFrame) -> list[str]:
|
| 62 |
if predictions_df.empty:
|
| 63 |
return [ALL_OPTION]
|
|
|
|
| 111 |
filtered["prompt"] = filtered["prompt"].map(normalize_prompt)
|
| 112 |
filtered["prompt"] = filtered["prompt"].map(compact_prompt)
|
| 113 |
filtered["processed_prediction"] = filtered["processed_prediction"].map(shorten_prediction)
|
| 114 |
+
filtered["task"] = [
|
| 115 |
+
format_task_ref(task_id, index)
|
| 116 |
+
for task_id, index in zip(filtered["task_id"], filtered["index"], strict=False)
|
| 117 |
+
]
|
| 118 |
filtered = filtered.rename(columns={"processed_prediction": "prediction"})
|
| 119 |
+
filtered = filtered.sort_values(by=["task_id", "index", "prompt"], kind="stable")
|
| 120 |
filtered = filtered[PREDICTION_COLUMNS]
|
| 121 |
+
return filtered.reset_index(drop=True)
|
| 122 |
|
| 123 |
|
| 124 |
def render_predictions_tab(predictions_df: pd.DataFrame) -> None:
|