File size: 2,545 Bytes
5ecb433
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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



import pandas as pd
import gradio as gr
from ui.leaderboard import render_leader_board, render_info_html
from ui.df_arena_tool import render_tool_info
from ui.submission import render_submission_page
import os
from utils import load_leaderboard
from huggingface_hub import snapshot_download
import gradio as gr
import os
import json

REPO_ID = os.getenv('REPO_ID')
DB_ERR_PATH = f'./data/data/leaderboard_err.csv'
DB_ACCURACY_PATH = f'./data/data/leaderboard_accuracy.csv'
CITATIONS_PATH = f'./data/data/model_citations.json'

if not os.path.exists('./data/data'):
    snapshot_download(repo_id=REPO_ID, 
                      repo_type="dataset", local_dir='./data/data')


with open(CITATIONS_PATH, 'r') as f:
    model_citations = json.load(f)

# Load leaderboard data
leaderboard_df_err = load_leaderboard(DB_ERR_PATH)
leaderboard_df_accuracy = load_leaderboard(DB_ACCURACY_PATH)

# Function to load leaderboard data

custom_css = """
h1,  {
    font-size: 50px !important; /* Increase heading sizes */
    line-height: 2.0 !important; /* Increase line spacing */
    text-align: center !important; /* Center align headings */
}

.gradio-container {
    padding: 30px !important;  /* Increase padding around the UI */
}

.markdown-body p {
    font-size: 30px !important; /* Increase text size */
    line-height: 2.0 !important; /* More space between lines */
}

.gradio-container .gr-block {
    margin-bottom: 20px !important; /* Add more space between elements */
}
"""

# Gradio Interface Configuration
def create_ui():
    with gr.Blocks(theme=gr.themes.Soft(text_size=gr.themes.sizes.text_lg), css=custom_css) as demo:
        # gr.Markdown("# Speech Deep Fake Arena")
        gr.Image('/data/code/DF_arena_leaderboard/leaderboard/data/df_arena.jpg')
        
        with gr.Tabs():
            with gr.Tab("πŸ† Leaderboard"):
                with gr.Column():
                    render_info_html()
                    gr.Markdown("Table for Equal Error Rate (EER %) for different systems")
                    render_leader_board(leaderboard_df_err, model_citations)  # Adjust this to work with Gradio components
                    gr.Markdown("Table for Accuracy (EER %) for different systems")

                    render_leader_board(leaderboard_df_accuracy, model_citations)
                     
            with gr.Tab("πŸ›  Evaluation"):
                render_tool_info()  
            with gr.Tab("πŸ“€ Submission"):
                render_submission_page()  

    return demo


# Launch the app
create_ui().launch()