|
import gradio as gr |
|
import pandas as pd |
|
from huggingface_hub import list_models |
|
import plotly.express as px |
|
|
|
def get_plots(task): |
|
|
|
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_layout(hovermode="y") |
|
return fig |
|
|
|
def get_model_names(task_data): |
|
|
|
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(): |
|
|
|
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() |
|
|