Spaces:
Sleeping
Sleeping
Refactor leaderboard HTML code (#1)
Browse files- Refactor new leaderboard html (d09e6c4a8164da67964a75214bfc411b6854eeb2)
app.py
CHANGED
|
@@ -5,6 +5,7 @@ from PIL import Image
|
|
| 5 |
from io import BytesIO
|
| 6 |
import os
|
| 7 |
import tempfile
|
|
|
|
| 8 |
|
| 9 |
BASE_URL = "https://huggingface.co/datasets/zonszer/demo_source_data/resolve/main"
|
| 10 |
|
|
@@ -107,13 +108,7 @@ with gr.Blocks(title="World-in-World: Building a Closed-Loop World Interface to
|
|
| 107 |
|
| 108 |
|
| 109 |
with gr.TabItem("📊 Leaderboard"):
|
| 110 |
-
|
| 111 |
-
value=create_leaderboard(),
|
| 112 |
-
headers=COLUMNS,
|
| 113 |
-
datatype=["str", "str", "str", "str", "str", "number", "number"],
|
| 114 |
-
interactive=False,
|
| 115 |
-
wrap=True
|
| 116 |
-
)
|
| 117 |
|
| 118 |
with gr.TabItem("📝 About"):
|
| 119 |
gr.Markdown("""
|
|
|
|
| 5 |
from io import BytesIO
|
| 6 |
import os
|
| 7 |
import tempfile
|
| 8 |
+
from src.leaderboard.leaderboard_html import create_leaderboard_html
|
| 9 |
|
| 10 |
BASE_URL = "https://huggingface.co/datasets/zonszer/demo_source_data/resolve/main"
|
| 11 |
|
|
|
|
| 108 |
|
| 109 |
|
| 110 |
with gr.TabItem("📊 Leaderboard"):
|
| 111 |
+
gr.HTML(create_leaderboard_html())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
with gr.TabItem("📝 About"):
|
| 114 |
gr.Markdown("""
|
src/leaderboard/leaderboard_html.py
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ab based on `task_sucess_leaderboard.html`
|
| 2 |
+
def create_leaderboard_html():
|
| 3 |
+
|
| 4 |
+
html_content = """
|
| 5 |
+
<div style="
|
| 6 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
|
| 7 |
+
background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
|
| 8 |
+
color: #ffffff;
|
| 9 |
+
margin: 0;
|
| 10 |
+
padding: 20px;
|
| 11 |
+
min-height: 100vh;
|
| 12 |
+
border-radius: 12px;
|
| 13 |
+
">
|
| 14 |
+
<div style="
|
| 15 |
+
max-width: 1200px;
|
| 16 |
+
margin: 0 auto;
|
| 17 |
+
background: rgba(0, 0, 0, 0.4);
|
| 18 |
+
border-radius: 16px;
|
| 19 |
+
padding: 40px;
|
| 20 |
+
backdrop-filter: blur(10px);
|
| 21 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 22 |
+
">
|
| 23 |
+
<div style="text-align: center; margin-bottom: 40px;">
|
| 24 |
+
<h1 style="
|
| 25 |
+
font-size: 3rem;
|
| 26 |
+
font-weight: 700;
|
| 27 |
+
margin: 0 0 16px 0;
|
| 28 |
+
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
|
| 29 |
+
background-clip: text;
|
| 30 |
+
-webkit-background-clip: text;
|
| 31 |
+
-webkit-text-fill-color: transparent;
|
| 32 |
+
text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
| 33 |
+
">Video World Models Leaderboard</h1>
|
| 34 |
+
<p style="
|
| 35 |
+
font-size: 1.2rem;
|
| 36 |
+
color: #b0b0b0;
|
| 37 |
+
margin: 0;
|
| 38 |
+
font-weight: 300;
|
| 39 |
+
">Measuring performance on task success and generation quality</p>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div class="legend-row"
|
| 43 |
+
style="
|
| 44 |
+
display: flex;
|
| 45 |
+
justify-content: center;
|
| 46 |
+
gap: 30px;
|
| 47 |
+
margin: 30px 0;
|
| 48 |
+
padding: 20px;
|
| 49 |
+
background: rgba(255, 255, 255, 0.02);
|
| 50 |
+
border-radius: 8px;
|
| 51 |
+
flex-wrap: wrap;
|
| 52 |
+
--body-text-color:#fff
|
| 53 |
+
">
|
| 54 |
+
<div style="display: flex; align-items: center; gap: 8px; font-size: 0.9rem;">
|
| 55 |
+
<div style="width: 16px; height: 16px; border-radius: 3px; background: #ec4899;"></div>
|
| 56 |
+
<span>Zero-Shot Video Models</span>
|
| 57 |
+
</div>
|
| 58 |
+
<div style="display: flex; align-items: center; gap: 8px; font-size: 0.9rem;">
|
| 59 |
+
<div style="width: 16px; height: 16px; border-radius: 3px; background: #06b6d4;"></div>
|
| 60 |
+
<span>Post-Trained Video Models</span>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<h2 style="
|
| 65 |
+
font-size: 2rem;
|
| 66 |
+
font-weight: 600;
|
| 67 |
+
margin: 0 0 30px 0;
|
| 68 |
+
color: #ffffff;
|
| 69 |
+
">Performance Rankings</h2>
|
| 70 |
+
|
| 71 |
+
<div style="
|
| 72 |
+
background: rgba(255, 255, 255, 0.02);
|
| 73 |
+
border-radius: 12px;
|
| 74 |
+
padding: 20px;
|
| 75 |
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 76 |
+
">
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
# Ranking data
|
| 80 |
+
models_data = [
|
| 81 |
+
{"rank": 1, "name": "Wan2.1†", "category": "Alibaba • Video Generation", "task_success": "62.6%", "gen_quality": "0.380", "type": "research", "success_width": 100, "quality_width": 79},
|
| 82 |
+
{"rank": 2, "name": "SVD†", "category": "Stability AI • Video Generation", "task_success": "61.0%", "gen_quality": "0.363", "type": "research", "success_width": 97, "quality_width": 76},
|
| 83 |
+
{"rank": 3, "name": "Cosmos†", "category": "Nvidia • Video Generation", "task_success": "60.3%", "gen_quality": "0.360", "type": "research", "success_width": 96, "quality_width": 75},
|
| 84 |
+
{"rank": 4, "name": "Wan2.1", "category": "Alibaba • Video Generation", "task_success": "58.3%", "gen_quality": "0.478", "type": "commercial", "success_width": 93, "quality_width": 100},
|
| 85 |
+
{"rank": 5, "name": "Hunyuan", "category": "Tencent • Video Generation", "task_success": "57.7%", "gen_quality": "0.396", "type": "commercial", "success_width": 92, "quality_width": 83},
|
| 86 |
+
{"rank": 5, "name": "SVD", "category": "Stability AI • Video Generation", "task_success": "57.7%", "gen_quality": "0.371", "type": "commercial", "success_width": 92, "quality_width": 78},
|
| 87 |
+
{"rank": 7, "name": "SE3DS", "category": "Open Source • 3D Scene", "task_success": "57.5%", "gen_quality": "0.365", "type": "open-source", "success_width": 92, "quality_width": 76},
|
| 88 |
+
{"rank": 7, "name": "LTX†", "category": "Lightricks • Video Generation", "task_success": "57.5%", "gen_quality": "0.340", "type": "research", "success_width": 92, "quality_width": 71},
|
| 89 |
+
{"rank": 9, "name": "NWM", "category": "Meta • World Models", "task_success": "57.4%", "gen_quality": "0.325", "type": "open-source", "success_width": 92, "quality_width": 68},
|
| 90 |
+
{"rank": 10, "name": "Pathdreamer", "category": "Open Source • Pano Path Generation", "task_success": "57.0%", "gen_quality": "0.339", "type": "open-source", "success_width": 91, "quality_width": 71},
|
| 91 |
+
{"rank": 11, "name": "Wan2.2†", "category": "Alibaba • Video Generation", "task_success": "56.3%", "gen_quality": "0.380", "type": "research", "success_width": 90, "quality_width": 79},
|
| 92 |
+
{"rank": 12, "name": "Cosmos", "category": "Nvidia • Video Generation", "task_success": "55.4%", "gen_quality": "0.480", "type": "commercial", "success_width": 89, "quality_width": 100},
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
+
# Mapping of model type -> highlight color
|
| 96 |
+
type_colors = {
|
| 97 |
+
"commercial": "#ec4899",
|
| 98 |
+
"research": "#06b6d4",
|
| 99 |
+
"open-source": "#10b981"
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
# Loop through models and render each row
|
| 103 |
+
for model in models_data:
|
| 104 |
+
border_color = type_colors.get(model["type"], "#ffffff")
|
| 105 |
+
|
| 106 |
+
html_content += f"""
|
| 107 |
+
<div style="
|
| 108 |
+
display: flex;
|
| 109 |
+
align-items: center;
|
| 110 |
+
margin-bottom: 12px;
|
| 111 |
+
padding: 16px;
|
| 112 |
+
background: rgba(255, 255, 255, 0.03);
|
| 113 |
+
border-radius: 8px;
|
| 114 |
+
transition: all 0.3s ease;
|
| 115 |
+
border-left: 4px solid {border_color};
|
| 116 |
+
" onmouseover="this.style.background='rgba(255, 255, 255, 0.08)'; this.style.transform='translateX(4px)';"
|
| 117 |
+
onmouseout="this.style.background='rgba(255, 255, 255, 0.03)'; this.style.transform='translateX(0)';">
|
| 118 |
+
|
| 119 |
+
<div style="
|
| 120 |
+
background: rgba(255, 255, 255, 0.1);
|
| 121 |
+
width: 36px;
|
| 122 |
+
height: 36px;
|
| 123 |
+
border-radius: 8px;
|
| 124 |
+
display: flex;
|
| 125 |
+
align-items: center;
|
| 126 |
+
justify-content: center;
|
| 127 |
+
font-weight: 700;
|
| 128 |
+
margin-right: 20px;
|
| 129 |
+
font-size: 16px;
|
| 130 |
+
min-width: 36px;
|
| 131 |
+
color: #ffffff !important;
|
| 132 |
+
">{model["rank"]}</div>
|
| 133 |
+
|
| 134 |
+
<div style="flex: 1; margin-right: 20px; min-width: 200px;">
|
| 135 |
+
<div style="font-weight: 600; font-size: 1.1rem; margin-bottom: 4px; color: #ffffff !important;">{model["name"]}</div>
|
| 136 |
+
<div style="font-size: 0.85rem; color: #cccccc !important; opacity: 1;">{model["category"]}</div>
|
| 137 |
+
</div>
|
| 138 |
+
|
| 139 |
+
<div style="display: flex; flex-direction: column; gap: 8px; width: 200px; margin: 0 20px;">
|
| 140 |
+
<div style="height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden;">
|
| 141 |
+
<div style="height: 100%; background: linear-gradient(90deg, #10b981, #f59e0b); border-radius: 3px; width: {model["success_width"]}%; transition: all 1.2s ease-in-out;"></div>
|
| 142 |
+
</div>
|
| 143 |
+
<div style="height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden;">
|
| 144 |
+
<div style="height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 3px; width: {model["quality_width"]}%; transition: all 1.2s ease-in-out;"></div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<div style="display: flex; align-items: center; gap: 20px; margin-left: auto;">
|
| 149 |
+
<div style="text-align: center; min-width: 120px;">
|
| 150 |
+
<div style="font-size: 0.75rem; color: #aaaaaa !important; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;">Task Success</div>
|
| 151 |
+
<div style="font-size: 1.2rem; font-weight: 700; color: #f59e0b !important;">{model["task_success"]}</div>
|
| 152 |
+
</div>
|
| 153 |
+
<div style="text-align: center; min-width: 120px;">
|
| 154 |
+
<div style="font-size: 0.75rem; color: #aaaaaa !important; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;">Gen Quality</div>
|
| 155 |
+
<div style="font-size: 1.2rem; font-weight: 700; color: #6366f1 !important;">{model["gen_quality"]}</div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
"""
|
| 160 |
+
|
| 161 |
+
html_content += """
|
| 162 |
+
</div>
|
| 163 |
+
|
| 164 |
+
<div style="text-align: center; margin-top: 40px; color: #cccccc !important; font-size: 0.9rem;">
|
| 165 |
+
<p style="color: #cccccc !important;">Task Success Rate measures completion of video generation objectives • Generation Quality measures visual fidelity and coherence</p>
|
| 166 |
+
</div>
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
<style>
|
| 171 |
+
@media (max-width: 968px) {
|
| 172 |
+
.model-item {
|
| 173 |
+
flex-direction: column !important;
|
| 174 |
+
align-items: flex-start !important;
|
| 175 |
+
gap: 12px !important;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
.metrics-section {
|
| 179 |
+
width: 100% !important;
|
| 180 |
+
justify-content: space-between !important;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
.progress-bars {
|
| 184 |
+
width: 100% !important;
|
| 185 |
+
margin: 12px 0 !important;
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
</style>
|
| 189 |
+
"""
|
| 190 |
+
|
| 191 |
+
return html_content
|
task_sucess_leaderboard.html → src/leaderboard/task_sucess_leaderboard.html
RENAMED
|
File without changes
|