Rui1121 commited on
Commit
e9db7ac
·
verified ·
1 Parent(s): 6c6d75e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -29
app.py CHANGED
@@ -58,7 +58,7 @@ LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS,
58
 
59
  # --- 📌 Define Column Groups ---
60
 
61
- # Tab 1: Generation (Strictly matching Table 1 - 9 columns + Model)
62
  COLS_GEN = [
63
  "Model",
64
  # LongText2Video
@@ -69,19 +69,18 @@ COLS_GEN = [
69
  "Video2Video / CLIP", "Video2Video / DINO", "Video2Video / MLLM"
70
  ]
71
 
72
- # Tab 2: Long-Video Tasks (Understanding, Editing, Segmentation)
73
  COLS_LONG = [
74
  "Model",
75
  "LongVideo QA / Acc", # Understanding
76
- "Editing / MLLM", # Editing
77
- "Segmentation / J&F" # Segmentation
 
 
 
 
78
  ]
79
 
80
- # Filter out columns not present in the dataframe to prevent errors
81
- # (Note: We don't filter COLS_GEN here strictly because we want to see if they are missing,
82
- # but standard practice is to filter. Assuming populate.py logic fills missing ones with empty strings/NaN)
83
- COLS_LONG = [c for c in COLS_LONG if c in LEADERBOARD_DF.columns]
84
-
85
  # --- UI Layout ---
86
  demo = gr.Blocks(css=custom_css)
87
 
@@ -96,44 +95,58 @@ with demo:
96
  gr.Markdown("### Table 1: Comparison across LongText2Video, Entities2Video and Video2Video")
97
 
98
  # 1. Select Columns
99
- # We use a list comprehension to ensure we only pick columns that actually exist in DF
100
- # to avoid KeyErrors, but keep the order defined in COLS_GEN
101
  valid_gen_cols = [c for c in COLS_GEN if c in LEADERBOARD_DF.columns]
102
  df_gen = LEADERBOARD_DF[valid_gen_cols].copy()
103
 
104
- # 2. Filter Rows (Only specific models)
105
- target_models = ["UniVA", "LTX-Video", "Wan", "Seedance"]
106
- # Ensure strict matching with 'Model' column
107
  if "Model" in df_gen.columns:
108
- df_gen = df_gen[df_gen["Model"].isin(target_models)]
109
-
110
- # 3. Sort rows by the order in target_models list
111
- # This sets the order to: UniVA, LTX-Video, Wan, Seedance (or however you arranged target_models)
112
- df_gen["Model"] = pd.Categorical(df_gen["Model"], categories=target_models, ordered=True)
113
  df_gen = df_gen.sort_values("Model")
114
 
115
  gr.Dataframe(
116
  value=df_gen,
117
  headers=valid_gen_cols,
118
- datatype="markdown", # Markdown allows links to render
119
  elem_id="leaderboard-table-gen",
120
  interactive=False,
121
  visible=True,
122
  )
123
 
124
- # === Tab 2: Long-Video Tasks (Table 2) ===
125
- with gr.TabItem("🧠 Long-Video Tasks", elem_id="tab-long", id=1):
126
- gr.Markdown("### Long-Video Understanding, Editing & Segmentation")
127
 
128
- # Prepare data: Default sort by Understanding (Acc)
129
- df_long = LEADERBOARD_DF[COLS_LONG]
130
- sort_col = "LongVideo QA / Acc"
131
- if sort_col in df_long.columns:
132
- df_long = df_long.sort_values(by=sort_col, ascending=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  gr.Dataframe(
135
  value=df_long,
136
- headers=COLS_LONG,
137
  datatype="markdown",
138
  elem_id="leaderboard-table-long",
139
  interactive=False,
 
58
 
59
  # --- 📌 Define Column Groups ---
60
 
61
+ # Tab 1: Generation (Table 1)
62
  COLS_GEN = [
63
  "Model",
64
  # LongText2Video
 
69
  "Video2Video / CLIP", "Video2Video / DINO", "Video2Video / MLLM"
70
  ]
71
 
72
+ # Tab 2: Perception & Editing (Table 2 - 7 Data Columns)
73
  COLS_LONG = [
74
  "Model",
75
  "LongVideo QA / Acc", # Understanding
76
+ "Editing / CLIP", # Editing
77
+ "Editing / DINO",
78
+ "Editing / MLLM",
79
+ "Segmentation / J", # Segmentation
80
+ "Segmentation / F",
81
+ "Segmentation / J&F"
82
  ]
83
 
 
 
 
 
 
84
  # --- UI Layout ---
85
  demo = gr.Blocks(css=custom_css)
86
 
 
95
  gr.Markdown("### Table 1: Comparison across LongText2Video, Entities2Video and Video2Video")
96
 
97
  # 1. Select Columns
 
 
98
  valid_gen_cols = [c for c in COLS_GEN if c in LEADERBOARD_DF.columns]
99
  df_gen = LEADERBOARD_DF[valid_gen_cols].copy()
100
 
101
+ # 2. Filter Rows (Only specific models for Table 1)
102
+ target_models_gen = ["UniVA", "LTX-Video", "Wan", "Seedance"]
103
+
104
  if "Model" in df_gen.columns:
105
+ df_gen = df_gen[df_gen["Model"].isin(target_models_gen)]
106
+ # Sort by defined order
107
+ df_gen["Model"] = pd.Categorical(df_gen["Model"], categories=target_models_gen, ordered=True)
 
 
108
  df_gen = df_gen.sort_values("Model")
109
 
110
  gr.Dataframe(
111
  value=df_gen,
112
  headers=valid_gen_cols,
113
+ datatype="markdown",
114
  elem_id="leaderboard-table-gen",
115
  interactive=False,
116
  visible=True,
117
  )
118
 
119
+ # === Tab 2: Perception & Editing (Table 2) ===
120
+ with gr.TabItem("🧠 Perception & Editing", elem_id="tab-long", id=1):
121
+ gr.Markdown("### Table 2: Understanding, Editing, and Segmentation")
122
 
123
+ # 1. Select Columns
124
+ valid_long_cols = [c for c in COLS_LONG if c in LEADERBOARD_DF.columns]
125
+ df_long = LEADERBOARD_DF[valid_long_cols].copy()
126
+
127
+ # 2. Filter Rows (Only specific models for Table 2)
128
+ # Removing pure generation models (Wan, LTX, Seedance) as they don't have these scores
129
+ target_models_long = [
130
+ "UniVA",
131
+ "InternVL3-38B",
132
+ "Qwen2.5-VL-72B",
133
+ "Gemini 2.5 Pro",
134
+ "GPT-4o",
135
+ "Vace",
136
+ "SA2VA"
137
+ ]
138
+
139
+ if "Model" in df_long.columns:
140
+ df_long = df_long[df_long["Model"].isin(target_models_long)]
141
+
142
+ # 3. Sort: Default by Understanding Acc
143
+ sort_col = "LongVideo QA / Acc"
144
+ if sort_col in df_long.columns:
145
+ df_long = df_long.sort_values(by=sort_col, ascending=False)
146
 
147
  gr.Dataframe(
148
  value=df_long,
149
+ headers=valid_long_cols,
150
  datatype="markdown",
151
  elem_id="leaderboard-table-long",
152
  interactive=False,