Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,9 @@ organizations=['Alphabet','Allen Institute for AI', 'Alibaba', 'Amazon', 'Anthro
|
|
22 |
|
23 |
def generate_figure(org_name):
|
24 |
org_data = data[data['Organization'] == org_name]
|
25 |
-
|
|
|
|
|
26 |
fig.update_layout(xaxis_type='category')
|
27 |
fig.update_xaxes(categoryorder="category ascending")
|
28 |
return fig
|
@@ -42,11 +44,12 @@ with gr.Blocks() as demo:
|
|
42 |
with gr.Row():
|
43 |
with gr.Column():
|
44 |
gr.Markdown("### All Data")
|
45 |
-
|
|
|
|
|
46 |
fig2.update_layout(xaxis_type='category')
|
47 |
fig2.update_xaxes(categoryorder="category ascending")
|
48 |
-
|
49 |
-
|
50 |
plt2 = gr.Plot(fig2)
|
51 |
with gr.Row():
|
52 |
with gr.Column(scale=1):
|
|
|
22 |
|
23 |
def generate_figure(org_name):
|
24 |
org_data = data[data['Organization'] == org_name]
|
25 |
+
model_counts = org_data.groupby('Year')[['Model','Environmental Transparency']].value_counts().reset_index()
|
26 |
+
model_counts.columns = ['Year', 'Model','Environmental Transparency','Count']
|
27 |
+
fig = px.bar(model_counts, x="Year", y="Count",color='Environmental Transparency', color_discrete_map =color_discrete_map, hover_data=["Model"])
|
28 |
fig.update_layout(xaxis_type='category')
|
29 |
fig.update_xaxes(categoryorder="category ascending")
|
30 |
return fig
|
|
|
44 |
with gr.Row():
|
45 |
with gr.Column():
|
46 |
gr.Markdown("### All Data")
|
47 |
+
counts = data.groupby('Year')[['Model','Environmental Transparency']].value_counts().reset_index()
|
48 |
+
counts.columns = ['Year', 'Model','Environmental Transparency','Count']
|
49 |
+
fig2 = px.bar(model_counts, x="Year", y="Count",color='Environmental Transparency', color_discrete_map =color_discrete_map, hover_data=["Model"])
|
50 |
fig2.update_layout(xaxis_type='category')
|
51 |
fig2.update_xaxes(categoryorder="category ascending")
|
52 |
+
|
|
|
53 |
plt2 = gr.Plot(fig2)
|
54 |
with gr.Row():
|
55 |
with gr.Column(scale=1):
|