Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ def get_plots(task):
|
|
59 |
width=800,
|
60 |
color_discrete_map=color_map
|
61 |
)
|
62 |
-
#
|
63 |
fig.update_traces(
|
64 |
hovertemplate="<br>".join([
|
65 |
"Model: %{y}",
|
@@ -67,7 +67,12 @@ def get_plots(task):
|
|
67 |
"Energy Score: %{customdata[0]}"
|
68 |
])
|
69 |
)
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
71 |
return fig
|
72 |
|
73 |
def get_all_plots():
|
@@ -101,7 +106,11 @@ def get_all_plots():
|
|
101 |
"Energy Score: %{customdata[0]}"
|
102 |
])
|
103 |
)
|
104 |
-
fig.update_layout(
|
|
|
|
|
|
|
|
|
105 |
return fig
|
106 |
|
107 |
def get_model_names(task):
|
@@ -109,11 +118,11 @@ def get_model_names(task):
|
|
109 |
if df.columns[0].startswith("Unnamed:"):
|
110 |
df = df.iloc[:, 1:]
|
111 |
df['energy_score'] = df['energy_score'].astype(int)
|
112 |
-
# Ensure GPU Energy is a float and format it to 4 decimals
|
113 |
df['GPU Energy (Wh)'] = df['total_gpu_energy'].astype(float).apply(lambda x: f"{x:.4f}")
|
114 |
df['Model'] = df['model'].apply(make_link)
|
115 |
df['Score'] = df['energy_score'].apply(format_stars)
|
116 |
-
# Remove any Class column
|
117 |
df = df[['Model', 'GPU Energy (Wh)', 'Score']]
|
118 |
df = df.sort_values(by='GPU Energy (Wh)')
|
119 |
return df
|
@@ -162,7 +171,11 @@ def get_text_generation_plots(model_class):
|
|
162 |
"Energy Score: %{customdata[0]}"
|
163 |
])
|
164 |
)
|
165 |
-
fig.update_layout(
|
|
|
|
|
|
|
|
|
166 |
return fig
|
167 |
|
168 |
def get_text_generation_model_names(model_class):
|
|
|
59 |
width=800,
|
60 |
color_discrete_map=color_map
|
61 |
)
|
62 |
+
# Hover text now shows GPU Energy (Wh) with 4 decimals
|
63 |
fig.update_traces(
|
64 |
hovertemplate="<br>".join([
|
65 |
"Model: %{y}",
|
|
|
67 |
"Energy Score: %{customdata[0]}"
|
68 |
])
|
69 |
)
|
70 |
+
# Set the x-axis tickformat to 4 decimals
|
71 |
+
fig.update_layout(
|
72 |
+
xaxis_title="GPU Energy (Wh)",
|
73 |
+
yaxis_title="Model",
|
74 |
+
xaxis=dict(tickformat=".4f")
|
75 |
+
)
|
76 |
return fig
|
77 |
|
78 |
def get_all_plots():
|
|
|
106 |
"Energy Score: %{customdata[0]}"
|
107 |
])
|
108 |
)
|
109 |
+
fig.update_layout(
|
110 |
+
xaxis_title="GPU Energy (Wh)",
|
111 |
+
yaxis_title="Model",
|
112 |
+
xaxis=dict(tickformat=".4f")
|
113 |
+
)
|
114 |
return fig
|
115 |
|
116 |
def get_model_names(task):
|
|
|
118 |
if df.columns[0].startswith("Unnamed:"):
|
119 |
df = df.iloc[:, 1:]
|
120 |
df['energy_score'] = df['energy_score'].astype(int)
|
121 |
+
# Ensure GPU Energy is a float and format it to 4 decimals for display
|
122 |
df['GPU Energy (Wh)'] = df['total_gpu_energy'].astype(float).apply(lambda x: f"{x:.4f}")
|
123 |
df['Model'] = df['model'].apply(make_link)
|
124 |
df['Score'] = df['energy_score'].apply(format_stars)
|
125 |
+
# Remove any Class column if it exists
|
126 |
df = df[['Model', 'GPU Energy (Wh)', 'Score']]
|
127 |
df = df.sort_values(by='GPU Energy (Wh)')
|
128 |
return df
|
|
|
171 |
"Energy Score: %{customdata[0]}"
|
172 |
])
|
173 |
)
|
174 |
+
fig.update_layout(
|
175 |
+
xaxis_title="GPU Energy (Wh)",
|
176 |
+
yaxis_title="Model",
|
177 |
+
xaxis=dict(tickformat=".4f")
|
178 |
+
)
|
179 |
return fig
|
180 |
|
181 |
def get_text_generation_model_names(model_class):
|