Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -151,7 +151,7 @@ def get_zip_data_link():
|
|
| 151 |
f'<a href="data:application/zip;base64,{b64}" '
|
| 152 |
'download="data.zip" '
|
| 153 |
'style="text-decoration: none; font-weight: bold; font-size: 1.1em; '
|
| 154 |
-
'color:
|
| 155 |
)
|
| 156 |
return href
|
| 157 |
|
|
@@ -170,7 +170,7 @@ def update_text_generation(selected_display, sort_order):
|
|
| 170 |
return df
|
| 171 |
df = process_df('text_generation.csv', sort_order, filter_fn)
|
| 172 |
ratio = compute_efficiency_ratio(df)
|
| 173 |
-
# For Text Generation, use "this class"
|
| 174 |
callout = generate_info_callout(ratio, "this class")
|
| 175 |
table_html = generate_html_table_from_df(df)
|
| 176 |
return callout, table_html
|
|
@@ -275,10 +275,9 @@ global_header_html = f"""
|
|
| 275 |
</div>
|
| 276 |
"""
|
| 277 |
|
| 278 |
-
###
|
| 279 |
-
|
| 280 |
-
# Additional CSS for dark mode and mobile responsiveness
|
| 281 |
custom_css = """
|
|
|
|
| 282 |
.gr-dataframe table {
|
| 283 |
table-layout: fixed;
|
| 284 |
width: 100%;
|
|
@@ -309,30 +308,32 @@ custom_css = """
|
|
| 309 |
color: #e0e0e0;
|
| 310 |
}
|
| 311 |
a {
|
| 312 |
-
color: #bb86fc;
|
| 313 |
}
|
| 314 |
}
|
| 315 |
|
| 316 |
/* Mobile styles: hide callout boxes on small screens */
|
| 317 |
@media (max-width: 600px) {
|
| 318 |
.info-callout {
|
| 319 |
-
display: none;
|
| 320 |
}
|
| 321 |
}
|
| 322 |
"""
|
| 323 |
|
|
|
|
|
|
|
| 324 |
demo = gr.Blocks(css=custom_css)
|
| 325 |
|
| 326 |
with demo:
|
| 327 |
# --- Header Links ---
|
| 328 |
gr.HTML(f"""
|
| 329 |
<div style="display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 20px;">
|
| 330 |
-
<a href="https://huggingface.co/spaces/AIEnergyScore/submission_portal" style="text-decoration: none; font-weight: bold; font-size: 1.1em;
|
| 331 |
-
<a href="https://huggingface.co/spaces/AIEnergyScore/Label" style="text-decoration: none; font-weight: bold; font-size: 1.1em;
|
| 332 |
-
<a href="https://huggingface.github.io/AIEnergyScore/#faq" style="text-decoration: none; font-weight: bold; font-size: 1.1em;
|
| 333 |
-
<a href="https://huggingface.github.io/AIEnergyScore/#documentation" style="text-decoration: none; font-weight: bold; font-size: 1.1em;
|
| 334 |
{get_zip_data_link()}
|
| 335 |
-
<a href="https://huggingface.co/spaces/AIEnergyScore/README/discussions" style="text-decoration: none; font-weight: bold; font-size: 1.1em;
|
| 336 |
</div>
|
| 337 |
""")
|
| 338 |
|
|
|
|
| 151 |
f'<a href="data:application/zip;base64,{b64}" '
|
| 152 |
'download="data.zip" '
|
| 153 |
'style="text-decoration: none; font-weight: bold; font-size: 1.1em; '
|
| 154 |
+
'color: inherit; font-family: \'Inter\', sans-serif;">Download Data</a>'
|
| 155 |
)
|
| 156 |
return href
|
| 157 |
|
|
|
|
| 170 |
return df
|
| 171 |
df = process_df('text_generation.csv', sort_order, filter_fn)
|
| 172 |
ratio = compute_efficiency_ratio(df)
|
| 173 |
+
# For Text Generation, use "this class" as the scope.
|
| 174 |
callout = generate_info_callout(ratio, "this class")
|
| 175 |
table_html = generate_html_table_from_df(df)
|
| 176 |
return callout, table_html
|
|
|
|
| 275 |
</div>
|
| 276 |
"""
|
| 277 |
|
| 278 |
+
### CUSTOM CSS for Dark Mode and Mobile Responsiveness ###
|
|
|
|
|
|
|
| 279 |
custom_css = """
|
| 280 |
+
/* Table and layout */
|
| 281 |
.gr-dataframe table {
|
| 282 |
table-layout: fixed;
|
| 283 |
width: 100%;
|
|
|
|
| 308 |
color: #e0e0e0;
|
| 309 |
}
|
| 310 |
a {
|
| 311 |
+
color: #bb86fc !important;
|
| 312 |
}
|
| 313 |
}
|
| 314 |
|
| 315 |
/* Mobile styles: hide callout boxes on small screens */
|
| 316 |
@media (max-width: 600px) {
|
| 317 |
.info-callout {
|
| 318 |
+
display: none !important;
|
| 319 |
}
|
| 320 |
}
|
| 321 |
"""
|
| 322 |
|
| 323 |
+
### GRADIO INTERFACE ###
|
| 324 |
+
|
| 325 |
demo = gr.Blocks(css=custom_css)
|
| 326 |
|
| 327 |
with demo:
|
| 328 |
# --- Header Links ---
|
| 329 |
gr.HTML(f"""
|
| 330 |
<div style="display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 20px;">
|
| 331 |
+
<a href="https://huggingface.co/spaces/AIEnergyScore/submission_portal" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Submission Portal</a>
|
| 332 |
+
<a href="https://huggingface.co/spaces/AIEnergyScore/Label" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Label Generator</a>
|
| 333 |
+
<a href="https://huggingface.github.io/AIEnergyScore/#faq" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">FAQ</a>
|
| 334 |
+
<a href="https://huggingface.github.io/AIEnergyScore/#documentation" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Documentation</a>
|
| 335 |
{get_zip_data_link()}
|
| 336 |
+
<a href="https://huggingface.co/spaces/AIEnergyScore/README/discussions" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Community</a>
|
| 337 |
</div>
|
| 338 |
""")
|
| 339 |
|