Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
refactor: restructure the files
Browse files- app.py +3 -4
- src/{display/columns.py → columns.py} +0 -0
- src/{display/components.py → components.py} +0 -0
- src/{display/css_html_js.py → css_html_js.py} +0 -0
- src/display/formatting.py +0 -29
- src/models.py +11 -1
- src/utils.py +9 -2
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from huggingface_hub import snapshot_download
|
|
| 6 |
|
| 7 |
from src.about import BENCHMARKS_TEXT, EVALUATION_QUEUE_TEXT, INTRODUCTION_TEXT, TITLE
|
| 8 |
from src.benchmarks import LongDocBenchmarks, QABenchmarks
|
| 9 |
-
from src.
|
| 10 |
get_anonymous_checkbox,
|
| 11 |
get_domain_dropdown,
|
| 12 |
get_language_dropdown,
|
|
@@ -18,8 +18,7 @@ from src.display.components import (
|
|
| 18 |
get_search_bar,
|
| 19 |
get_version_dropdown,
|
| 20 |
)
|
| 21 |
-
from src.
|
| 22 |
-
from src.display.formatting import model_hyperlink
|
| 23 |
from src.envs import (
|
| 24 |
API,
|
| 25 |
BENCHMARK_VERSION_LIST,
|
|
@@ -35,7 +34,7 @@ from src.envs import (
|
|
| 35 |
TOKEN,
|
| 36 |
)
|
| 37 |
from src.loaders import load_eval_results
|
| 38 |
-
from src.models import TaskType
|
| 39 |
from src.utils import remove_html, reset_rank, set_listeners, submit_results, update_metric, upload_file
|
| 40 |
|
| 41 |
|
|
|
|
| 6 |
|
| 7 |
from src.about import BENCHMARKS_TEXT, EVALUATION_QUEUE_TEXT, INTRODUCTION_TEXT, TITLE
|
| 8 |
from src.benchmarks import LongDocBenchmarks, QABenchmarks
|
| 9 |
+
from src.components import (
|
| 10 |
get_anonymous_checkbox,
|
| 11 |
get_domain_dropdown,
|
| 12 |
get_language_dropdown,
|
|
|
|
| 18 |
get_search_bar,
|
| 19 |
get_version_dropdown,
|
| 20 |
)
|
| 21 |
+
from src.css_html_js import custom_css
|
|
|
|
| 22 |
from src.envs import (
|
| 23 |
API,
|
| 24 |
BENCHMARK_VERSION_LIST,
|
|
|
|
| 34 |
TOKEN,
|
| 35 |
)
|
| 36 |
from src.loaders import load_eval_results
|
| 37 |
+
from src.models import TaskType, model_hyperlink
|
| 38 |
from src.utils import remove_html, reset_rank, set_listeners, submit_results, update_metric, upload_file
|
| 39 |
|
| 40 |
|
src/{display/columns.py → columns.py}
RENAMED
|
File without changes
|
src/{display/components.py → components.py}
RENAMED
|
File without changes
|
src/{display/css_html_js.py → css_html_js.py}
RENAMED
|
File without changes
|
src/display/formatting.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
def model_hyperlink(link, model_name):
|
| 2 |
-
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
def make_clickable_model(model_name: str, model_link: str):
|
| 6 |
-
# link = f"https://huggingface.co/{model_name}"
|
| 7 |
-
if not model_link or not model_link.startswith("https://"):
|
| 8 |
-
return model_name
|
| 9 |
-
return model_hyperlink(model_link, model_name)
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
def styled_error(error):
|
| 13 |
-
return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
def styled_warning(warn):
|
| 17 |
-
return f"<p style='color: orange; font-size: 20px; text-align: center;'>{warn}</p>"
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
def styled_message(message):
|
| 21 |
-
return f"<p style='color: green; font-size: 20px; text-align: center;'>{message}</p>"
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
def has_no_nan_values(df, columns):
|
| 25 |
-
return df[columns].notna().all(axis=1)
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
def has_nan_values(df, columns):
|
| 29 |
-
return df[columns].isna().any(axis=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/models.py
CHANGED
|
@@ -7,7 +7,6 @@ from typing import List, Optional
|
|
| 7 |
|
| 8 |
import pandas as pd
|
| 9 |
|
| 10 |
-
from src.display.formatting import make_clickable_model
|
| 11 |
from src.envs import (
|
| 12 |
COL_NAME_IS_ANONYMOUS,
|
| 13 |
COL_NAME_RERANKING_MODEL,
|
|
@@ -159,3 +158,14 @@ class LeaderboardDataStore:
|
|
| 159 |
class TaskType(Enum):
|
| 160 |
qa = "qa"
|
| 161 |
long_doc = "long-doc"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
import pandas as pd
|
| 9 |
|
|
|
|
| 10 |
from src.envs import (
|
| 11 |
COL_NAME_IS_ANONYMOUS,
|
| 12 |
COL_NAME_RERANKING_MODEL,
|
|
|
|
| 158 |
class TaskType(Enum):
|
| 159 |
qa = "qa"
|
| 160 |
long_doc = "long-doc"
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def make_clickable_model(model_name: str, model_link: str):
|
| 164 |
+
# link = f"https://huggingface.co/{model_name}"
|
| 165 |
+
if not model_link or not model_link.startswith("https://"):
|
| 166 |
+
return model_name
|
| 167 |
+
return model_hyperlink(model_link, model_name)
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def model_hyperlink(link, model_name):
|
| 171 |
+
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
src/utils.py
CHANGED
|
@@ -8,8 +8,7 @@ import pandas as pd
|
|
| 8 |
|
| 9 |
from src.models import TaskType
|
| 10 |
from src.benchmarks import LongDocBenchmarks, QABenchmarks
|
| 11 |
-
from src.
|
| 12 |
-
from src.display.formatting import styled_error, styled_message
|
| 13 |
from src.envs import (
|
| 14 |
API,
|
| 15 |
COL_NAME_AVG,
|
|
@@ -441,3 +440,11 @@ def update_qa_df_elem(
|
|
| 441 |
reset_ranking,
|
| 442 |
show_revision_and_timestamp,
|
| 443 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
from src.models import TaskType
|
| 10 |
from src.benchmarks import LongDocBenchmarks, QABenchmarks
|
| 11 |
+
from src.columns import get_default_col_names_and_types, get_fixed_col_names_and_types
|
|
|
|
| 12 |
from src.envs import (
|
| 13 |
API,
|
| 14 |
COL_NAME_AVG,
|
|
|
|
| 440 |
reset_ranking,
|
| 441 |
show_revision_and_timestamp,
|
| 442 |
)
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
def styled_error(error):
|
| 446 |
+
return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
|
| 447 |
+
|
| 448 |
+
|
| 449 |
+
def styled_message(message):
|
| 450 |
+
return f"<p style='color: green; font-size: 20px; text-align: center;'>{message}</p>"
|