File size: 2,222 Bytes
726379a
 
 
 
03f436a
726379a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
03f436a
726379a
03f436a
726379a
 
03f436a
726379a
 
03f436a
 
726379a
 
 
 
 
 
03f436a
726379a
 
03f436a
726379a
03f436a
726379a
03f436a
726379a
03f436a
726379a
 
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
73
74
75
76
77
78
79
80
81
82
83
import gradio as gr
import pandas as pd
import plotly.express as px

merged_df = pd.read_csv("data/merged_cloud_data.csv")

tdp_fig = px.scatter(
    merged_df,
    x="Total TDP (W)",
    y="$/Hour",
    color="provider",
    log_x=True,
    log_y=True,
    trendline="ols",
    trendline_options=dict(log_y=True, log_x=True),
    trendline_scope="overall",
)


cost_fig = px.scatter(
    merged_df,
    x="GPU Total Cost",
    y="$/Hour",
    color="GPU Type",
    log_y=True,
    log_x=True,
    trendline="ols",
    trendline_options=dict(log_x=True, log_y=True),
    trendline_scope="overall",
)


def generate_figure(org_name):
    org_data = data[data["Organization"] == org_name]
    model_counts = (
        org_data.groupby("Year")[["Model", "Environmental Transparency"]]
        .value_counts()
        .reset_index()
    )
    model_counts.columns = ["Year", "Model", "Environmental Transparency", "Count"]
    fig = px.bar(
        model_counts,
        x="Year",
        y="Count",
        color="Environmental Transparency",
        color_discrete_map=color_discrete_map,
        hover_data=["Model"],
    )
    fig.update_layout(xaxis_type="category")
    fig.update_xaxes(categoryorder="category ascending")
    return fig


with gr.Blocks() as demo:
    gr.Markdown("# Cloud Compute ☁️, Energy ⚡ and Cost 💲 - Explorer Tool")
    gr.Markdown(
        "## Explore the data from 'When we pay for cloud compute, what are we really paying for?'"
    )
    with gr.Accordion("Methodology", open=False):
        gr.Markdown("TODO")
    with gr.Row():
        with gr.Column():
            gr.Markdown("### TDP Data")
            plt1 = gr.Plot(tdp_fig)
    with gr.Row():
        with gr.Column(scale=1):
            org_choice = gr.Dropdown(
                organizations,
                value="",
                label="Organizations",
                info="Pick a characteristic to regenerate plot",
                interactive=True,
            )

        with gr.Column(scale=4):
            gr.Markdown("### Cost Data")
            fig = generate_figure(org_choice)
            plt = gr.Plot(cost_fig)

    # org_choice.select(generate_figure, inputs=[org_choice], outputs=[plt])

demo.launch()