File size: 3,222 Bytes
f2e5135
 
 
 
4f39516
f2e5135
 
 
e7ee45c
4f39516
f2e5135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60351b6
 
 
 
 
f2e5135
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import csv

# Load the leaderboard data
def load_data():
    df = pd.read_csv("leaderboard_results.csv", quotechar='"', escapechar='\\', 
                     skipinitialspace=True, quoting=csv.QUOTE_MINIMAL)
    return df

# Create a bar chart visualization of the accuracy scores
def create_accuracy_chart(df):
    fig, ax = plt.subplots(figsize=(10, 6))
    
    # Sort by accuracy for better visualization
    df_sorted = df.sort_values(by='Test Acc', ascending=False)
    
    # Create bar chart
    bars = ax.bar(df_sorted['Solution'], df_sorted['Test Acc'], color='skyblue')
    
    # Highlight the best performer
    bars[0].set_color('gold')
    
    # Add labels and title
    ax.set_xlabel('Solution')
    ax.set_ylabel('Test Accuracy')
    ax.set_title('Leaderboard Results by Accuracy')
    
    # Rotate x-axis labels for better readability
    plt.xticks(rotation=45, ha='right')
    
    # Add text labels on bars
    for bar in bars:
        height = bar.get_height()
        ax.text(bar.get_x() + bar.get_width()/2., height + 0.01,
                f'{height:.5f}', ha='center', va='bottom')
    
    plt.tight_layout()
    return fig

# Display detailed information for a selected solution
def display_solution_details(solution_name):
    df = load_data()
    if solution_name:
        solution_data = df[df['Solution'] == solution_name].iloc[0]
        details = f"""
## {solution_data['Solution']} Details

- **Test Accuracy**: {solution_data['Test Acc']:.5f}
- **Institution**: {solution_data['Institution']}
- **Region**: {solution_data['Region']}
- **Paper**: {solution_data['Paper']}
- **Lead Author**: {solution_data['Lead Author']}
        """
        return details
    return "Please select a solution to see details."

# Main interface
def create_interface():
    df = load_data()
    
    with gr.Blocks(title="Emotion Recognition Leaderboard") as demo:
        gr.Markdown("# Speech-based Emotion Recognition Leaderboard")
        
        with gr.Row():
            with gr.Column():
                # Display the full leaderboard table
                gr.DataFrame(
                    df.sort_values(by='Test Acc', ascending=False),
                    label="Leaderboard Results"
                )
        
        with gr.Row():
            # Add dropdown for selecting a specific solution for more details
            solution_dropdown = gr.Dropdown(
                choices=df['Solution'].tolist(),
                label="Select Solution for Details"
            )
            
            # Display area for solution details
            solution_details = gr.Markdown()

        with gr.Row():
            with gr.Column():
                # Display the visualization
                gr.Plot(create_accuracy_chart(df))
        
        # Update solution details when dropdown changes
        solution_dropdown.change(
            display_solution_details,
            inputs=solution_dropdown,
            outputs=solution_details
        )
            
    return demo

# Load data, create and launch the interface
if __name__ == "__main__":
    demo = create_interface()
    demo.launch()