File size: 2,762 Bytes
460fdc7
 
 
42e8f64
 
b7b78a8
2dc39dd
b7b78a8
 
535ed01
2f8fc9d
b7b78a8
 
 
 
13ef1b6
e5599c2
 
f7b4006
d4ded0a
e5599c2
d4ded0a
d8b9e17
ba0ef01
d4ded0a
c76229c
7022131
f7b4006
7022131
7786ff5
7022131
 
 
7786ff5
f7b4006
7022131
f7b4006
2dc39dd
c03ab70
2dc39dd
b7b78a8
2dc39dd
7022131
f7b4006
2dc39dd
b7b78a8
2dc39dd
b7b78a8
2dc39dd
7022131
f7b4006
d4ded0a
b7b78a8
d4ded0a
b7b78a8
d4ded0a
7022131
f7b4006
2dc39dd
b7b78a8
2dc39dd
b7b78a8
2dc39dd
7022131
f7b4006
2dc39dd
b7b78a8
2dc39dd
b7b78a8
f7b4006
7022131
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
import gradio as gr
import pandas as pd
from huggingface_hub import list_models
import plotly.express as px

def get_plots(task):
    #TO DO : hover text with energy efficiency number, parameters
    task_df= pd.read_csv('data/energy/'+task)
    params_df = pd.read_csv('data/params/'+task)
    all_df = pd.merge(task_df, params_df, on='Link')
    print(all_df.head())
    all_df['Total GPU Energy (Wh)'] = all_df['total_gpu_energy']*1000
    all_df = task_df.sort_values(by=['Total GPU Energy (Wh)'])
    all_df['energy_star'] = pd.cut(all_df['Total GPU Energy (Wh)'], 3, labels=["⭐⭐⭐", "⭐⭐", "⭐"])
    fig = px.scatter(all_df, x="model", y='Total GPU Energy (Wh)', height= 500, width= 800, color = 'energy_star', color_discrete_map={"⭐": 'red', "⭐⭐": "yellow", "⭐⭐⭐": "green"})
    #fig.update_traces(mode="markers+lines", hovertemplate=None)
    fig.update_layout(hovermode="y")
    return fig

def get_model_names(task_data):
    #TODO: add link to results in model card of each model
    task_df= pd.read_csv(task_data)
    model_names = task_df[['model']]
    return model_names


demo = gr.Blocks()

with demo:
    gr.Markdown(
        """# Energy Star Leaderboard

    TODO """
    )
    with gr.Tabs():
        with gr.TabItem("Text Generation πŸ’¬"):
            with gr.Row():
                with gr.Column():
                    #plot = gr.Plot(get_plots('text_generation.csv'))
                with gr.Column():
                    table = gr.Dataframe(get_model_names('text_generation.csv'))

        with gr.TabItem("Image Generation πŸ“·"):
            with gr.Row():
                with gr.Column():
                    plot = gr.Plot(get_plots('image_generation.csv'))
                with gr.Column():
                    table = gr.Dataframe(get_model_names('image_generation.csv'))

        with gr.TabItem("Text Classification 🎭"):
            with gr.Row():
                with gr.Column():
                    plot = gr.Plot(get_plots('text_classification.csv'))
                with gr.Column():
                    table = gr.Dataframe(get_model_names('text_classification.csv'))

        with gr.TabItem("Image Classification πŸ–ΌοΈ"):
            with gr.Row():
                with gr.Column():
                    plot = gr.Plot(get_plots('image_classification.csv'))
                with gr.Column():
                    table = gr.Dataframe(get_model_names('image_classification.csv'))

        with gr.TabItem("Extractive QA ❔"):
            with gr.Row():
                with gr.Column():
                    plot = gr.Plot(get_plots('question_answering.csv'))
                with gr.Column():
                    table = gr.Dataframe(get_model_names('question_answering.csv'))

demo.launch()