Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,10 +49,10 @@ def get_plots(task):
|
|
49 |
df['energy_score'] = df['energy_score'].astype(int).astype(str)
|
50 |
# Create a display model column for labeling
|
51 |
df['Display Model'] = df['model'].apply(lambda m: m.split('/')[-1])
|
52 |
-
|
53 |
# Use the energy score to control color
|
54 |
color_map = {"1": "red", "2": "orange", "3": "yellow", "4": "lightgreen", "5": "green"}
|
55 |
-
|
56 |
# Now plot with the model name on the X axis and GPU Energy on the Y axis.
|
57 |
fig = px.scatter(
|
58 |
df,
|
@@ -74,7 +74,8 @@ def get_plots(task):
|
|
74 |
)
|
75 |
fig.update_layout(
|
76 |
xaxis_title="Model",
|
77 |
-
yaxis_title="GPU Energy (Wh)"
|
|
|
78 |
)
|
79 |
return fig
|
80 |
|
@@ -89,9 +90,9 @@ def get_all_plots():
|
|
89 |
df['Display Model'] = df['model'].apply(lambda m: m.split('/')[-1])
|
90 |
all_df = pd.concat([all_df, df], ignore_index=True)
|
91 |
all_df = all_df.drop_duplicates(subset=['model'])
|
92 |
-
|
93 |
color_map = {"1": "red", "2": "orange", "3": "yellow", "4": "lightgreen", "5": "green"}
|
94 |
-
|
95 |
fig = px.scatter(
|
96 |
all_df,
|
97 |
x="Display Model",
|
@@ -111,7 +112,8 @@ def get_all_plots():
|
|
111 |
)
|
112 |
fig.update_layout(
|
113 |
xaxis_title="Model",
|
114 |
-
yaxis_title="GPU Energy (Wh)"
|
|
|
115 |
)
|
116 |
return fig
|
117 |
|
@@ -156,9 +158,9 @@ def get_text_generation_plots(model_class):
|
|
156 |
df['total_gpu_energy'] = pd.to_numeric(df['total_gpu_energy'], errors='raise')
|
157 |
df['energy_score'] = df['energy_score'].astype(int).astype(str)
|
158 |
df['Display Model'] = df['model'].apply(lambda m: m.split('/')[-1])
|
159 |
-
|
160 |
color_map = {"1": "red", "2": "orange", "3": "yellow", "4": "lightgreen", "5": "green"}
|
161 |
-
|
162 |
fig = px.scatter(
|
163 |
df,
|
164 |
x="Display Model",
|
@@ -178,7 +180,8 @@ def get_text_generation_plots(model_class):
|
|
178 |
)
|
179 |
fig.update_layout(
|
180 |
xaxis_title="Model",
|
181 |
-
yaxis_title="GPU Energy (Wh)"
|
|
|
182 |
)
|
183 |
return fig
|
184 |
|
@@ -223,7 +226,7 @@ with demo:
|
|
223 |
### Welcome to the leaderboard for the [AI Energy Score Project!](https://huggingface.co/AIEnergyScore)
|
224 |
Select different tasks to see scored models. Submit open models for testing and learn about testing proprietary models via the [submission portal](https://huggingface.co/spaces/AIEnergyScore/submission_portal)"""
|
225 |
)
|
226 |
-
|
227 |
with gr.Tabs():
|
228 |
# --- Text Generation Tab with Dropdown for Model Class ---
|
229 |
with gr.TabItem("Text Generation 💬"):
|
@@ -240,77 +243,77 @@ Select different tasks to see scored models. Submit open models for testing and
|
|
240 |
model_class_dropdown.change(fn=update_text_generation,
|
241 |
inputs=model_class_dropdown,
|
242 |
outputs=[tg_plot, tg_table])
|
243 |
-
|
244 |
with gr.TabItem("Image Generation 📷"):
|
245 |
with gr.Row():
|
246 |
with gr.Column():
|
247 |
plot = gr.Plot(get_plots('image_generation.csv'))
|
248 |
with gr.Column():
|
249 |
table = gr.Dataframe(get_model_names('image_generation.csv'), datatype="markdown")
|
250 |
-
|
251 |
with gr.TabItem("Text Classification 🎭"):
|
252 |
with gr.Row():
|
253 |
with gr.Column():
|
254 |
plot = gr.Plot(get_plots('text_classification.csv'))
|
255 |
with gr.Column():
|
256 |
table = gr.Dataframe(get_model_names('text_classification.csv'), datatype="markdown")
|
257 |
-
|
258 |
with gr.TabItem("Image Classification 🖼️"):
|
259 |
with gr.Row():
|
260 |
with gr.Column():
|
261 |
plot = gr.Plot(get_plots('image_classification.csv'))
|
262 |
with gr.Column():
|
263 |
table = gr.Dataframe(get_model_names('image_classification.csv'), datatype="markdown")
|
264 |
-
|
265 |
with gr.TabItem("Image Captioning 📝"):
|
266 |
with gr.Row():
|
267 |
with gr.Column():
|
268 |
plot = gr.Plot(get_plots('image_captioning.csv'))
|
269 |
with gr.Column():
|
270 |
table = gr.Dataframe(get_model_names('image_captioning.csv'), datatype="markdown")
|
271 |
-
|
272 |
with gr.TabItem("Summarization 📃"):
|
273 |
with gr.Row():
|
274 |
with gr.Column():
|
275 |
plot = gr.Plot(get_plots('summarization.csv'))
|
276 |
with gr.Column():
|
277 |
table = gr.Dataframe(get_model_names('summarization.csv'), datatype="markdown")
|
278 |
-
|
279 |
with gr.TabItem("Automatic Speech Recognition 💬"):
|
280 |
with gr.Row():
|
281 |
with gr.Column():
|
282 |
plot = gr.Plot(get_plots('asr.csv'))
|
283 |
with gr.Column():
|
284 |
table = gr.Dataframe(get_model_names('asr.csv'), datatype="markdown")
|
285 |
-
|
286 |
with gr.TabItem("Object Detection 🚘"):
|
287 |
with gr.Row():
|
288 |
with gr.Column():
|
289 |
plot = gr.Plot(get_plots('object_detection.csv'))
|
290 |
with gr.Column():
|
291 |
table = gr.Dataframe(get_model_names('object_detection.csv'), datatype="markdown")
|
292 |
-
|
293 |
with gr.TabItem("Sentence Similarity 📚"):
|
294 |
with gr.Row():
|
295 |
with gr.Column():
|
296 |
plot = gr.Plot(get_plots('sentence_similarity.csv'))
|
297 |
with gr.Column():
|
298 |
table = gr.Dataframe(get_model_names('sentence_similarity.csv'), datatype="markdown")
|
299 |
-
|
300 |
with gr.TabItem("Extractive QA ❔"):
|
301 |
with gr.Row():
|
302 |
with gr.Column():
|
303 |
plot = gr.Plot(get_plots('question_answering.csv'))
|
304 |
with gr.Column():
|
305 |
table = gr.Dataframe(get_model_names('question_answering.csv'), datatype="markdown")
|
306 |
-
|
307 |
with gr.TabItem("All Tasks 💡"):
|
308 |
with gr.Row():
|
309 |
with gr.Column():
|
310 |
plot = gr.Plot(get_all_plots())
|
311 |
with gr.Column():
|
312 |
table = gr.Dataframe(get_all_model_names(), datatype="markdown")
|
313 |
-
|
314 |
with gr.Accordion("📙 Citation", open=False):
|
315 |
citation_button = gr.Textbox(
|
316 |
value=CITATION_BUTTON_TEXT,
|
@@ -323,4 +326,4 @@ Select different tasks to see scored models. Submit open models for testing and
|
|
323 |
"""Last updated: February 2025"""
|
324 |
)
|
325 |
|
326 |
-
demo.launch()
|
|
|
49 |
df['energy_score'] = df['energy_score'].astype(int).astype(str)
|
50 |
# Create a display model column for labeling
|
51 |
df['Display Model'] = df['model'].apply(lambda m: m.split('/')[-1])
|
52 |
+
|
53 |
# Use the energy score to control color
|
54 |
color_map = {"1": "red", "2": "orange", "3": "yellow", "4": "lightgreen", "5": "green"}
|
55 |
+
|
56 |
# Now plot with the model name on the X axis and GPU Energy on the Y axis.
|
57 |
fig = px.scatter(
|
58 |
df,
|
|
|
74 |
)
|
75 |
fig.update_layout(
|
76 |
xaxis_title="Model",
|
77 |
+
yaxis_title="GPU Energy (Wh)",
|
78 |
+
yaxis_tickformat=".4f" # Add this line to format y-axis ticks
|
79 |
)
|
80 |
return fig
|
81 |
|
|
|
90 |
df['Display Model'] = df['model'].apply(lambda m: m.split('/')[-1])
|
91 |
all_df = pd.concat([all_df, df], ignore_index=True)
|
92 |
all_df = all_df.drop_duplicates(subset=['model'])
|
93 |
+
|
94 |
color_map = {"1": "red", "2": "orange", "3": "yellow", "4": "lightgreen", "5": "green"}
|
95 |
+
|
96 |
fig = px.scatter(
|
97 |
all_df,
|
98 |
x="Display Model",
|
|
|
112 |
)
|
113 |
fig.update_layout(
|
114 |
xaxis_title="Model",
|
115 |
+
yaxis_title="GPU Energy (Wh)",
|
116 |
+
yaxis_tickformat=".4f" # Add this line to format y-axis ticks
|
117 |
)
|
118 |
return fig
|
119 |
|
|
|
158 |
df['total_gpu_energy'] = pd.to_numeric(df['total_gpu_energy'], errors='raise')
|
159 |
df['energy_score'] = df['energy_score'].astype(int).astype(str)
|
160 |
df['Display Model'] = df['model'].apply(lambda m: m.split('/')[-1])
|
161 |
+
|
162 |
color_map = {"1": "red", "2": "orange", "3": "yellow", "4": "lightgreen", "5": "green"}
|
163 |
+
|
164 |
fig = px.scatter(
|
165 |
df,
|
166 |
x="Display Model",
|
|
|
180 |
)
|
181 |
fig.update_layout(
|
182 |
xaxis_title="Model",
|
183 |
+
yaxis_title="GPU Energy (Wh)",
|
184 |
+
yaxis_tickformat=".4f" # Add this line to format y-axis ticks
|
185 |
)
|
186 |
return fig
|
187 |
|
|
|
226 |
### Welcome to the leaderboard for the [AI Energy Score Project!](https://huggingface.co/AIEnergyScore)
|
227 |
Select different tasks to see scored models. Submit open models for testing and learn about testing proprietary models via the [submission portal](https://huggingface.co/spaces/AIEnergyScore/submission_portal)"""
|
228 |
)
|
229 |
+
|
230 |
with gr.Tabs():
|
231 |
# --- Text Generation Tab with Dropdown for Model Class ---
|
232 |
with gr.TabItem("Text Generation 💬"):
|
|
|
243 |
model_class_dropdown.change(fn=update_text_generation,
|
244 |
inputs=model_class_dropdown,
|
245 |
outputs=[tg_plot, tg_table])
|
246 |
+
|
247 |
with gr.TabItem("Image Generation 📷"):
|
248 |
with gr.Row():
|
249 |
with gr.Column():
|
250 |
plot = gr.Plot(get_plots('image_generation.csv'))
|
251 |
with gr.Column():
|
252 |
table = gr.Dataframe(get_model_names('image_generation.csv'), datatype="markdown")
|
253 |
+
|
254 |
with gr.TabItem("Text Classification 🎭"):
|
255 |
with gr.Row():
|
256 |
with gr.Column():
|
257 |
plot = gr.Plot(get_plots('text_classification.csv'))
|
258 |
with gr.Column():
|
259 |
table = gr.Dataframe(get_model_names('text_classification.csv'), datatype="markdown")
|
260 |
+
|
261 |
with gr.TabItem("Image Classification 🖼️"):
|
262 |
with gr.Row():
|
263 |
with gr.Column():
|
264 |
plot = gr.Plot(get_plots('image_classification.csv'))
|
265 |
with gr.Column():
|
266 |
table = gr.Dataframe(get_model_names('image_classification.csv'), datatype="markdown")
|
267 |
+
|
268 |
with gr.TabItem("Image Captioning 📝"):
|
269 |
with gr.Row():
|
270 |
with gr.Column():
|
271 |
plot = gr.Plot(get_plots('image_captioning.csv'))
|
272 |
with gr.Column():
|
273 |
table = gr.Dataframe(get_model_names('image_captioning.csv'), datatype="markdown")
|
274 |
+
|
275 |
with gr.TabItem("Summarization 📃"):
|
276 |
with gr.Row():
|
277 |
with gr.Column():
|
278 |
plot = gr.Plot(get_plots('summarization.csv'))
|
279 |
with gr.Column():
|
280 |
table = gr.Dataframe(get_model_names('summarization.csv'), datatype="markdown")
|
281 |
+
|
282 |
with gr.TabItem("Automatic Speech Recognition 💬"):
|
283 |
with gr.Row():
|
284 |
with gr.Column():
|
285 |
plot = gr.Plot(get_plots('asr.csv'))
|
286 |
with gr.Column():
|
287 |
table = gr.Dataframe(get_model_names('asr.csv'), datatype="markdown")
|
288 |
+
|
289 |
with gr.TabItem("Object Detection 🚘"):
|
290 |
with gr.Row():
|
291 |
with gr.Column():
|
292 |
plot = gr.Plot(get_plots('object_detection.csv'))
|
293 |
with gr.Column():
|
294 |
table = gr.Dataframe(get_model_names('object_detection.csv'), datatype="markdown")
|
295 |
+
|
296 |
with gr.TabItem("Sentence Similarity 📚"):
|
297 |
with gr.Row():
|
298 |
with gr.Column():
|
299 |
plot = gr.Plot(get_plots('sentence_similarity.csv'))
|
300 |
with gr.Column():
|
301 |
table = gr.Dataframe(get_model_names('sentence_similarity.csv'), datatype="markdown")
|
302 |
+
|
303 |
with gr.TabItem("Extractive QA ❔"):
|
304 |
with gr.Row():
|
305 |
with gr.Column():
|
306 |
plot = gr.Plot(get_plots('question_answering.csv'))
|
307 |
with gr.Column():
|
308 |
table = gr.Dataframe(get_model_names('question_answering.csv'), datatype="markdown")
|
309 |
+
|
310 |
with gr.TabItem("All Tasks 💡"):
|
311 |
with gr.Row():
|
312 |
with gr.Column():
|
313 |
plot = gr.Plot(get_all_plots())
|
314 |
with gr.Column():
|
315 |
table = gr.Dataframe(get_all_model_names(), datatype="markdown")
|
316 |
+
|
317 |
with gr.Accordion("📙 Citation", open=False):
|
318 |
citation_button = gr.Textbox(
|
319 |
value=CITATION_BUTTON_TEXT,
|
|
|
326 |
"""Last updated: February 2025"""
|
327 |
)
|
328 |
|
329 |
+
demo.launch()
|