merging dfs
Browse files
app.py
CHANGED
@@ -3,13 +3,15 @@ import pandas as pd
|
|
3 |
from huggingface_hub import list_models
|
4 |
import plotly.express as px
|
5 |
|
6 |
-
def get_plots(
|
7 |
#TO DO : hover text with energy efficiency number, parameters
|
8 |
-
task_df= pd.read_csv(
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
13 |
#fig.update_traces(mode="markers+lines", hovertemplate=None)
|
14 |
fig.update_layout(hovermode="y")
|
15 |
return fig
|
@@ -20,10 +22,6 @@ def get_model_names(task_data):
|
|
20 |
model_names = task_df[['model']]
|
21 |
return model_names
|
22 |
|
23 |
-
def get_params(param_data):
|
24 |
-
param_df= pd.read_csv(param_data)
|
25 |
-
model_params = {}
|
26 |
-
|
27 |
|
28 |
demo = gr.Blocks()
|
29 |
|
@@ -37,36 +35,36 @@ with demo:
|
|
37 |
with gr.TabItem("Text Generation π¬"):
|
38 |
with gr.Row():
|
39 |
with gr.Column():
|
40 |
-
plot = gr.Plot(get_plots('
|
41 |
with gr.Column():
|
42 |
-
table = gr.Dataframe(get_model_names('
|
43 |
|
44 |
with gr.TabItem("Image Generation π·"):
|
45 |
with gr.Row():
|
46 |
with gr.Column():
|
47 |
-
plot = gr.Plot(get_plots('
|
48 |
with gr.Column():
|
49 |
-
table = gr.Dataframe(get_model_names('
|
50 |
|
51 |
with gr.TabItem("Text Classification π"):
|
52 |
with gr.Row():
|
53 |
with gr.Column():
|
54 |
-
plot = gr.Plot(get_plots('
|
55 |
with gr.Column():
|
56 |
-
table = gr.Dataframe(get_model_names('
|
57 |
|
58 |
with gr.TabItem("Image Classification πΌοΈ"):
|
59 |
with gr.Row():
|
60 |
with gr.Column():
|
61 |
-
plot = gr.Plot(get_plots('
|
62 |
with gr.Column():
|
63 |
-
table = gr.Dataframe(get_model_names('
|
64 |
|
65 |
with gr.TabItem("Extractive QA β"):
|
66 |
with gr.Row():
|
67 |
with gr.Column():
|
68 |
-
plot = gr.Plot(get_plots('
|
69 |
with gr.Column():
|
70 |
-
table = gr.Dataframe(get_model_names('
|
71 |
|
72 |
demo.launch()
|
|
|
3 |
from huggingface_hub import list_models
|
4 |
import plotly.express as px
|
5 |
|
6 |
+
def get_plots(task):
|
7 |
#TO DO : hover text with energy efficiency number, parameters
|
8 |
+
task_df= pd.read_csv('data/energy/'+task)
|
9 |
+
params_df = pd.read_csv('data/params/'+task)
|
10 |
+
all_df = pd.merge(task_df, params_df, on='Link'))
|
11 |
+
all_df['Total GPU Energy (Wh)'] = all_df['total_gpu_energy']*1000
|
12 |
+
all_df = task_df.sort_values(by=['Total GPU Energy (Wh)'])
|
13 |
+
all_df['energy_star'] = pd.cut(all_df['Total GPU Energy (Wh)'], 3, labels=["βββ", "ββ", "β"])
|
14 |
+
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"})
|
15 |
#fig.update_traces(mode="markers+lines", hovertemplate=None)
|
16 |
fig.update_layout(hovermode="y")
|
17 |
return fig
|
|
|
22 |
model_names = task_df[['model']]
|
23 |
return model_names
|
24 |
|
|
|
|
|
|
|
|
|
25 |
|
26 |
demo = gr.Blocks()
|
27 |
|
|
|
35 |
with gr.TabItem("Text Generation π¬"):
|
36 |
with gr.Row():
|
37 |
with gr.Column():
|
38 |
+
plot = gr.Plot(get_plots('text_generation.csv'))
|
39 |
with gr.Column():
|
40 |
+
table = gr.Dataframe(get_model_names('text_generation.csv'))
|
41 |
|
42 |
with gr.TabItem("Image Generation π·"):
|
43 |
with gr.Row():
|
44 |
with gr.Column():
|
45 |
+
plot = gr.Plot(get_plots('image_generation.csv'))
|
46 |
with gr.Column():
|
47 |
+
table = gr.Dataframe(get_model_names('image_generation.csv'))
|
48 |
|
49 |
with gr.TabItem("Text Classification π"):
|
50 |
with gr.Row():
|
51 |
with gr.Column():
|
52 |
+
plot = gr.Plot(get_plots('text_classification.csv'))
|
53 |
with gr.Column():
|
54 |
+
table = gr.Dataframe(get_model_names('text_classification.csv'))
|
55 |
|
56 |
with gr.TabItem("Image Classification πΌοΈ"):
|
57 |
with gr.Row():
|
58 |
with gr.Column():
|
59 |
+
plot = gr.Plot(get_plots('image_classification.csv'))
|
60 |
with gr.Column():
|
61 |
+
table = gr.Dataframe(get_model_names('image_classification.csv'))
|
62 |
|
63 |
with gr.TabItem("Extractive QA β"):
|
64 |
with gr.Row():
|
65 |
with gr.Column():
|
66 |
+
plot = gr.Plot(get_plots('question_answering.csv'))
|
67 |
with gr.Column():
|
68 |
+
table = gr.Dataframe(get_model_names('question_answering.csv'))
|
69 |
|
70 |
demo.launch()
|