File size: 1,830 Bytes
42411ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import pandas as pd
import os
import plotly.express as px
import numpy as np

datadir = 'data/emissions/complete'

model_param_df = pd.read_csv('data/model_parameters.csv', header=0)
model_performance_df = pd.read_csv('data/performance.csv', header=0)
emissions_df = pd.read_csv('data/co2_data.csv',header=0)
modalities_df = pd.read_csv('data/modalities_data.csv',header=0)
finetuned_df = emissions_df[~emissions_df['task'].str.contains('zero')]

fig0 = px.scatter(finetuned_df, x="dataset", y="query emissions (g)", color="model", log_y=True)
fig0.update_layout(xaxis={'categoryorder':'mean ascending'})
fig0.update_layout(yaxis_title='Total carbon emitted (g)')
fig0.update_layout(xaxis_title='Dataset')


fig1 = px.box(finetuned_df, x="task", y="query_energy (kWh)", color="task", log_y=True)
fig1.update_layout(xaxis={'categoryorder':'mean ascending'})
fig1.update_layout(yaxis_title='Total energy used (Wh)')
fig1.update_layout(xaxis_title='Task')

fig2 = px.scatter(modalities_df, x="num_params", y="query emissions (g)", color="modality",
             log_x=True, log_y=True, custom_data=['model','task'])

fig2.update_traces(
    hovertemplate="<br>".join([
        "Model: %{customdata[0]}",
        "Task: %{customdata[1]}",
    ])
)
fig2.update_layout(xaxis_title='Model size (number of parameters)')
fig2.update_layout(yaxis_title='Model emissions (g of CO<sub>2</sub>)')


demo = gr.Blocks()

with demo:
    gr.Markdown("# CO2 Inference Demo")
    gr.Markdown("## Explore the plots below to get more insights about the different models and tasks from our study.")
    with gr.Row():
        with gr.Column():
            gr.Plot(fig0)
    with gr.Row():
        with gr.Column():
            gr.Plot(fig1)
    with gr.Row():
        with gr.Column():
            gr.Plot(fig2)






demo.launch()