File size: 2,821 Bytes
9a235dc
 
bc37111
 
 
9a235dc
 
bc37111
 
 
9a235dc
 
bc37111
 
 
9a235dc
bc37111
 
 
 
 
 
 
 
9a235dc
bc37111
9a235dc
 
bc37111
 
 
9a235dc
bc37111
 
9a235dc
bc37111
 
 
 
9a235dc
bc37111
 
 
 
9a235dc
bc37111
 
 
 
 
9a235dc
bc37111
 
 
 
 
 
 
 
 
 
 
 
 
 
9a235dc
bc37111
 
 
 
 
9a235dc
bc37111
 
 
 
9a235dc
bc37111
 
 
 
9a235dc
bc37111
 
 
 
 
 
 
 
 
 
 
 
 
9a235dc
 
 
bc37111
 
 
9a235dc
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python3
"""
Mizan Turkish Leaderboard - HuggingFace Space Version

Clean entry point that wires together all components.
"""

import logging
import sys

import gradio as gr

from src.core.config import settings
from src.data import DataTransformer
from src.components import LeaderboardTab, DatasetTab, SubmitTab

# Configure logging
logging.basicConfig(
    level=logging.DEBUG if settings.ui.debug else logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    handlers=[
        logging.StreamHandler(sys.stdout),
    ]
)

logger = logging.getLogger(__name__)


class MizanApp:
    """
    Main application class.
    
    Orchestrates all components and creates the Gradio interface.
    """
    
    def __init__(self):
        # Load data
        self.transformer = DataTransformer()
        self.data = self.transformer.load_from_csv()
        
        # UI components (will be initialized during build)
        self._leaderboard_tab: LeaderboardTab = None
        self._dataset_tab: DatasetTab = None
        self._submit_tab: SubmitTab = None
        
        logger.info(f"Application initialized with {len(self.data)} models")
    
    def build_interface(self) -> gr.Blocks:
        """
        Build the complete Gradio interface.
        
        Returns:
            Gradio Blocks application.
        """
        with gr.Blocks(
            title="🇹🇷 Mizan Turkish Leaderboard",
            theme=gr.themes.Soft()
        ) as demo:
            
            # Header
            gr.Markdown("""
            # 🇹🇷 Mizan Turkish Evaluation Leaderboard
            
            Performance comparison for Turkish embedding models
            """)
            
            with gr.Tabs():
                # Tab 1: Leaderboard
                with gr.Tab("Leaderboard"):
                    self._leaderboard_tab = LeaderboardTab(data=self.data)
                    self._leaderboard_tab.build()
                
                # Tab 2: Submit
                with gr.Tab("Submit"):
                    self._submit_tab = SubmitTab()
                    self._submit_tab.build()
                
                # Tab 3: Dataset Information
                with gr.Tab("Dataset Information"):
                    self._dataset_tab = DatasetTab()
                    self._dataset_tab.build()

        return demo
    
    def run(self):
        """Run the application."""
        logger.info("Starting Mizan Turkish Leaderboard...")
        
        # Build and launch
        demo = self.build_interface()
        demo.launch(
            server_name="0.0.0.0",
            server_port=settings.ui.port,
            share=False
        )


def main():
    """Main entry point."""
    app = MizanApp()
    app.run()


if __name__ == "__main__":
    main()