Quazim0t0 commited on
Commit
73cb2c4
·
verified ·
1 Parent(s): 5be33ac

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -115
app.py DELETED
@@ -1,115 +0,0 @@
1
- """
2
- Main application for Dynamic Highscores system.
3
-
4
- This file integrates all components into a unified application.
5
- """
6
-
7
- import os
8
- import gradio as gr
9
- import threading
10
- import queue
11
- from database_schema import init_db
12
- from auth import HuggingFaceAuth, create_login_ui, setup_auth_handlers
13
- from benchmark_selection import BenchmarkSelector, create_benchmark_selection_ui
14
- from evaluation_queue import EvaluationQueue, create_model_submission_ui
15
- from leaderboard import Leaderboard, create_leaderboard_ui
16
- from sample_benchmarks import add_sample_benchmarks
17
-
18
- # Initialize database
19
- db = init_db()
20
-
21
- # Initialize components
22
- auth_manager = HuggingFaceAuth(db)
23
- benchmark_selector = BenchmarkSelector(db, auth_manager)
24
- evaluation_queue = EvaluationQueue(db, auth_manager)
25
- leaderboard = Leaderboard(db)
26
-
27
- # Initialize sample benchmarks if none exist
28
- benchmarks = db.get_benchmarks()
29
- if not benchmarks or len(benchmarks) == 0:
30
- print("No benchmarks found. Adding sample benchmarks...")
31
- num_added = add_sample_benchmarks()
32
- print(f"Added {num_added} sample benchmarks.")
33
-
34
- # Custom CSS
35
- css = """
36
- .info-text {
37
- background-color: #f0f7ff;
38
- padding: 12px;
39
- border-radius: 8px;
40
- border-left: 4px solid #3498db;
41
- margin: 12px 0;
42
- }
43
-
44
- .container {
45
- max-width: 1200px;
46
- margin: 0 auto;
47
- }
48
-
49
- .header {
50
- text-align: center;
51
- margin-bottom: 20px;
52
- }
53
-
54
- .footer {
55
- text-align: center;
56
- margin-top: 40px;
57
- padding: 20px;
58
- border-top: 1px solid #eee;
59
- }
60
- """
61
-
62
- # Create Gradio app
63
- with gr.Blocks(css=css, title="Dynamic Highscores") as app:
64
- gr.Markdown("# 🏆 Dynamic Highscores", elem_classes=["header"])
65
- gr.Markdown("""
66
- Welcome to Dynamic Highscores - a community benchmark platform for evaluating and comparing language models.
67
-
68
- - **Add your own benchmarks** from HuggingFace datasets
69
- - **Submit your models** for CPU-only evaluation
70
- - **Compare performance** across different models and benchmarks
71
- - **Filter results** by model type (Merge, Agent, Reasoning, Coding, etc.)
72
- """, elem_classes=["info-text"])
73
-
74
- # Authentication UI
75
- login_button, logout_button, token_input, user_info = create_login_ui()
76
- setup_auth_handlers(login_button, logout_button, token_input, user_info, auth_manager)
77
-
78
- # Main tabs
79
- with gr.Tabs() as tabs:
80
- with gr.TabItem("📊 Leaderboard", id=0):
81
- # Fix: Pass db_manager parameter to create_leaderboard_ui
82
- leaderboard_ui = create_leaderboard_ui(leaderboard, db)
83
-
84
- with gr.TabItem("🚀 Submit Model", id=1):
85
- submission_ui = create_model_submission_ui(evaluation_queue, auth_manager, db)
86
-
87
- with gr.TabItem("🔍 Benchmarks", id=2):
88
- benchmark_ui = create_benchmark_selection_ui(benchmark_selector, auth_manager)
89
-
90
- gr.Markdown("""
91
- ### About Dynamic Highscores
92
-
93
- This platform allows users to select benchmarks from HuggingFace datasets and evaluate models against them.
94
- Each user can submit one benchmark per day (admin users are exempt from this limit).
95
- All evaluations run on CPU only to ensure fair comparisons.
96
-
97
- Created by Quazim0t0
98
- """, elem_classes=["footer"])
99
-
100
- # Start evaluation queue worker after app is defined
101
- # This prevents the worker from starting before the app is fully initialized
102
- def start_queue_worker():
103
- # Wait a moment to ensure app is initialized
104
- import time
105
- time.sleep(2)
106
- evaluation_queue.start_worker()
107
-
108
- # Launch the app
109
- if __name__ == "__main__":
110
- # Start queue worker in a separate thread to avoid SQLite thread issues
111
- queue_thread = threading.Thread(target=start_queue_worker)
112
- queue_thread.daemon = True
113
- queue_thread.start()
114
-
115
- app.launch()