sasha HF Staff commited on
Commit
03f436a
·
1 Parent(s): 369cd80

minimal working example

Browse files
Files changed (1) hide show
  1. app.py +11 -47
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import pandas as pd
3
  import plotly.express as px
4
 
5
- merged_df = pd.read_csv("merged_cloud_data.csv")
6
 
7
  tdp_fig = px.scatter(
8
  merged_df,
@@ -30,9 +30,6 @@ cost_fig = px.scatter(
30
  )
31
 
32
 
33
- color_discrete_map = {"Direct": "#2ca02c", "Indirect": "#1f77b4", "None": "#d62728"}
34
-
35
-
36
  def generate_figure(org_name):
37
  org_data = data[data["Organization"] == org_name]
38
  model_counts = (
@@ -55,64 +52,31 @@ def generate_figure(org_name):
55
 
56
 
57
  with gr.Blocks() as demo:
58
- gr.Markdown("# Environmental Transparency Explorer Tool 🕵️‍♀️🌎")
59
  gr.Markdown(
60
- "## Explore the data from 'Misinformation by Omission: The Need for More Environmental Transparency in AI'"
61
  )
62
  with gr.Accordion("Methodology", open=False):
63
- gr.Markdown(
64
- 'We analyzed Epoch AI\'s "Notable AI Models" dataset, which tracks information on “models that were state of the art, highly cited, \
65
- or otherwise historically notable” released over time. We selected the time period starting in 2010 as this is the beginning of the modern “deep learning era” \
66
- (as defined by Epoch AI), which is representative of the types of AI models currently trained and deployed, including all 754 models from 2010 \
67
- to the first quarter of 2025 in our analysis. We examined the level of environmental impact transparency for each model based on key information \
68
- from the Epoch AI dataset (e.g., model accessibility, training compute estimation method) as well as from individual model release content \
69
- (e.g., paper, model card, announcement).'
70
- )
71
  with gr.Row():
72
  with gr.Column():
73
- gr.Markdown("### All Data")
74
- counts = (
75
- data.groupby("Year")[["Model", "Environmental Transparency"]]
76
- .value_counts()
77
- .reset_index()
78
- )
79
- counts.columns = ["Year", "Model", "Environmental Transparency", "Count"]
80
- fig2 = px.bar(
81
- counts,
82
- x="Year",
83
- y="Count",
84
- color="Environmental Transparency",
85
- color_discrete_map=color_discrete_map,
86
- hover_data=["Model"],
87
- )
88
- fig2.update_layout(xaxis_type="category")
89
- fig2.update_xaxes(categoryorder="category ascending")
90
-
91
- plt2 = gr.Plot(fig2)
92
  with gr.Row():
93
  with gr.Column(scale=1):
94
  org_choice = gr.Dropdown(
95
  organizations,
96
  value="",
97
  label="Organizations",
98
- info="Pick an organization to explore their environmental disclosures",
99
  interactive=True,
100
  )
101
- gr.Markdown("The 3 transparency categories are:")
102
- gr.Markdown(
103
- "**Direct Disclosure**: Developers explicitly reported energy or GHG emissions, e.g., using hardware TDP, country average carbon intensity or measurements."
104
- )
105
- gr.Markdown(
106
- "**Indirect Disclosure**: Developers provided training compute data or released their model weights, allowing external estimates of training or inference impacts."
107
- )
108
- gr.Markdown(
109
- "**No Disclosure**: Environmental impact data was not publicly released and estimation approaches (as noted in Indirect Disclosure) were not possible."
110
- )
111
  with gr.Column(scale=4):
112
- gr.Markdown("### Data by Organization")
113
  fig = generate_figure(org_choice)
114
- plt = gr.Plot(fig)
115
 
116
- org_choice.select(generate_figure, inputs=[org_choice], outputs=[plt])
117
 
118
  demo.launch()
 
2
  import pandas as pd
3
  import plotly.express as px
4
 
5
+ merged_df = pd.read_csv("data/merged_cloud_data.csv")
6
 
7
  tdp_fig = px.scatter(
8
  merged_df,
 
30
  )
31
 
32
 
 
 
 
33
  def generate_figure(org_name):
34
  org_data = data[data["Organization"] == org_name]
35
  model_counts = (
 
52
 
53
 
54
  with gr.Blocks() as demo:
55
+ gr.Markdown("# Cloud Compute ☁️, Energy ⚡ and Cost 💲 - Explorer Tool")
56
  gr.Markdown(
57
+ "## Explore the data from 'When we pay for cloud compute, what are we really paying for?'"
58
  )
59
  with gr.Accordion("Methodology", open=False):
60
+ gr.Markdown("TODO")
 
 
 
 
 
 
 
61
  with gr.Row():
62
  with gr.Column():
63
+ gr.Markdown("### TDP Data")
64
+ plt1 = gr.Plot(tdp_fig)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  with gr.Row():
66
  with gr.Column(scale=1):
67
  org_choice = gr.Dropdown(
68
  organizations,
69
  value="",
70
  label="Organizations",
71
+ info="Pick a characteristic to regenerate plot",
72
  interactive=True,
73
  )
74
+
 
 
 
 
 
 
 
 
 
75
  with gr.Column(scale=4):
76
+ gr.Markdown("### Cost Data")
77
  fig = generate_figure(org_choice)
78
+ plt = gr.Plot(cost_fig)
79
 
80
+ # org_choice.select(generate_figure, inputs=[org_choice], outputs=[plt])
81
 
82
  demo.launch()