|
import gradio as gr |
|
import pandas as pd |
|
import matplotlib.pyplot as plt |
|
import numpy as np |
|
import csv |
|
|
|
|
|
def load_data(): |
|
df = pd.read_csv("leaderboard_results.csv", quotechar='"', escapechar='\\', |
|
skipinitialspace=True, quoting=csv.QUOTE_MINIMAL) |
|
return df |
|
|
|
|
|
def create_accuracy_chart(df): |
|
fig, ax = plt.subplots(figsize=(10, 6)) |
|
|
|
|
|
df_sorted = df.sort_values(by='Test Acc', ascending=False) |
|
|
|
|
|
bars = ax.bar(df_sorted['Solution'], df_sorted['Test Acc'], color='skyblue') |
|
|
|
|
|
bars[0].set_color('gold') |
|
|
|
|
|
ax.set_xlabel('Solution') |
|
ax.set_ylabel('Test Accuracy') |
|
ax.set_title('Leaderboard Results by Accuracy') |
|
|
|
|
|
plt.xticks(rotation=45, ha='right') |
|
|
|
|
|
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 |
|
|
|
|
|
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." |
|
|
|
|
|
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(): |
|
|
|
gr.DataFrame( |
|
df.sort_values(by='Test Acc', ascending=False), |
|
label="Leaderboard Results" |
|
) |
|
|
|
with gr.Row(): |
|
|
|
solution_dropdown = gr.Dropdown( |
|
choices=df['Solution'].tolist(), |
|
label="Select Solution for Details" |
|
) |
|
|
|
|
|
solution_details = gr.Markdown() |
|
|
|
with gr.Row(): |
|
with gr.Column(): |
|
|
|
gr.Plot(create_accuracy_chart(df)) |
|
|
|
|
|
solution_dropdown.change( |
|
display_solution_details, |
|
inputs=solution_dropdown, |
|
outputs=solution_details |
|
) |
|
|
|
return demo |
|
|
|
|
|
if __name__ == "__main__": |
|
demo = create_interface() |
|
demo.launch() |