File size: 2,557 Bytes
6b3e7b5 d8a1516 6b3e7b5 6e3ef2c d8a1516 6b3e7b5 4c5c1ef 6b3e7b5 d8a1516 4c5c1ef 6b3e7b5 6e3ef2c 6b3e7b5 c73c631 6b3e7b5 c73c631 6b3e7b5 6e3ef2c 6b3e7b5 d8a1516 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
"""
Main application for Dynamic Highscores system.
This file integrates all components into a unified application.
"""
import os
import gradio as gr
import threading
import time
from database_schema import DynamicHighscoresDB
from auth import HuggingFaceAuth, create_login_ui, setup_auth_handlers
from benchmark_selection import BenchmarkSelector, create_benchmark_selection_ui
from evaluation_queue import EvaluationQueue, create_model_submission_ui
from leaderboard import Leaderboard, create_leaderboard_ui
from sample_benchmarks import add_sample_benchmarks
# Initialize components in main thread
db = DynamicHighscoresDB()
auth_manager = HuggingFaceAuth(db)
benchmark_selector = BenchmarkSelector(db, auth_manager)
evaluation_queue = EvaluationQueue(db, auth_manager)
leaderboard = Leaderboard(db)
# Initialize sample benchmarks if none exist
print("Checking for existing benchmarks...")
benchmarks = db.get_benchmarks()
if not benchmarks or len(benchmarks) == 0:
print("No benchmarks found. Adding sample benchmarks...")
try:
num_added = add_sample_benchmarks()
print(f"Added {num_added} sample benchmarks.")
except Exception as e:
print(f"Error adding sample benchmarks: {str(e)}")
# Custom CSS
css = """
.info-text {
background-color: rgba(53, 130, 220, 0.1);
padding: 12px;
border-radius: 8px;
border-left: 4px solid #3498db;
margin: 12px 0;
}
"""
# Create Gradio app - NO THEME, NO OAUTH
with gr.Blocks(css=css, title="Dynamic Highscores") as app:
gr.Markdown("# ๐ Dynamic Highscores", elem_classes=["header"])
gr.Markdown("""
Welcome to Dynamic Highscores - a community benchmark platform for evaluating and comparing language models.
- **Add your own benchmarks** from HuggingFace datasets
- **Submit your models** for CPU-only evaluation
- **Compare performance** across different models and benchmarks
- **Filter results** by model type (Merge, Agent, Reasoning, Coding, etc.)
""", elem_classes=["info-text"])
# Main tabs
with gr.Tabs() as tabs:
with gr.TabItem("๐ Leaderboard", id=0):
leaderboard_ui = create_leaderboard_ui(leaderboard, db)
with gr.TabItem("๐ Submit Model", id=1):
submission_ui = create_model_submission_ui(evaluation_queue, auth_manager, db)
with gr.TabItem("๐ Benchmarks", id=2):
benchmark_ui = create_benchmark_selection_ui(benchmark_selector, auth_manager)
# Launch the app
if __name__ == "__main__":
app.launch() |