Update app.py
Browse files
app.py
CHANGED
@@ -42,26 +42,6 @@ WRITING_STYLE_COLS = ['#P', 'Model', 'Reg+MyScore π', 'Reg+Int π', 'MyScor
|
|
42 |
ANIME_RATING_COLS = ['#P', 'Model', 'Score π', 'Dif', 'Cor', 'Std']
|
43 |
|
44 |
# Load the leaderboard data from a CSV file
|
45 |
-
def load_leaderboard_data(csv_file_path):
|
46 |
-
try:
|
47 |
-
df = pd.read_csv(csv_file_path)
|
48 |
-
df['Model'] = df.apply(lambda row: f'<a href="{row["Link"]}" target="_blank" style="color: blue; text-decoration: none;">{row["Model"]}</a>' if pd.notna(row["Link"]) else row["Model"], axis=1)
|
49 |
-
df.drop(columns=['Link'], inplace=True)
|
50 |
-
|
51 |
-
# Round numeric columns to 3 decimal places
|
52 |
-
numeric_columns = df.select_dtypes(include=[np.number]).columns
|
53 |
-
df[numeric_columns] = df[numeric_columns].round(3)
|
54 |
-
|
55 |
-
# Round the W/10 column to 1 decimal place
|
56 |
-
if 'W/10 π' in df.columns:
|
57 |
-
df['W/10 π'] = df['W/10 π'].round(1)
|
58 |
-
|
59 |
-
return df
|
60 |
-
except Exception as e:
|
61 |
-
print(f"Error loading CSV file: {e}")
|
62 |
-
return pd.DataFrame(columns=UGI_COLS + WRITING_STYLE_COLS + ANIME_RATING_COLS)
|
63 |
-
|
64 |
-
# Update the leaderboard table based on the search query and parameter range filters
|
65 |
def update_table(df: pd.DataFrame, query: str, param_ranges: list, w10_range: list, columns: list) -> pd.DataFrame:
|
66 |
filtered_df = df.copy()
|
67 |
if param_ranges:
|
|
|
42 |
ANIME_RATING_COLS = ['#P', 'Model', 'Score π', 'Dif', 'Cor', 'Std']
|
43 |
|
44 |
# Load the leaderboard data from a CSV file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
def update_table(df: pd.DataFrame, query: str, param_ranges: list, w10_range: list, columns: list) -> pd.DataFrame:
|
46 |
filtered_df = df.copy()
|
47 |
if param_ranges:
|