Update src/display/formatting.py
Browse files- src/display/formatting.py +28 -16
src/display/formatting.py
CHANGED
@@ -1,29 +1,41 @@
|
|
1 |
# File: src/display/formatting.py
|
2 |
-
|
3 |
def model_hyperlink(link, model_name):
|
4 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline; text-decoration-style: dotted;">{model_name}</a>'
|
5 |
|
6 |
# ์ ์ญ์์ MODEL_MAPPING์ ๋จผ์ ์ ์ํฉ๋๋ค.
|
7 |
MODEL_MAPPING = {
|
8 |
"DeepSeek-R1": "deepseek-ai/DeepSeek-R1",
|
|
|
9 |
"OpenAI ChatGPT-4o": ("External Awesome Model", "https://chatgpt.com")
|
10 |
}
|
11 |
|
12 |
def make_clickable_model(model_name):
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
def styled_error(error):
|
29 |
return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
|
@@ -38,4 +50,4 @@ def has_no_nan_values(df, columns):
|
|
38 |
return df[columns].notna().all(axis=1)
|
39 |
|
40 |
def has_nan_values(df, columns):
|
41 |
-
return df[columns].isna().any(axis=1)
|
|
|
1 |
# File: src/display/formatting.py
|
|
|
2 |
def model_hyperlink(link, model_name):
|
3 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline; text-decoration-style: dotted;">{model_name}</a>'
|
4 |
|
5 |
# ์ ์ญ์์ MODEL_MAPPING์ ๋จผ์ ์ ์ํฉ๋๋ค.
|
6 |
MODEL_MAPPING = {
|
7 |
"DeepSeek-R1": "deepseek-ai/DeepSeek-R1",
|
8 |
+
"deepseek-r1": "deepseek-ai/DeepSeek-R1", # ์๋ฌธ์ ๋ฒ์ ๋ ์ถ๊ฐ
|
9 |
"OpenAI ChatGPT-4o": ("External Awesome Model", "https://chatgpt.com")
|
10 |
}
|
11 |
|
12 |
def make_clickable_model(model_name):
|
13 |
+
"""
|
14 |
+
๋ชจ๋ธ ์ด๋ฆ์ ๋ฐ์์ ํด๋ฆญ ๊ฐ๋ฅํ ํ์ดํผ๋งํฌ๋ก ๋ณํํฉ๋๋ค.
|
15 |
+
MODEL_MAPPING์ ์๋ ๋ชจ๋ธ์ ๋งคํ๋ ์ด๋ฆ๊ณผ URL์ ์ฌ์ฉํ๊ณ ,
|
16 |
+
์๋ ๋ชจ๋ธ์ ๊ธฐ๋ณธ Hugging Face URL์ ์ฌ์ฉํฉ๋๋ค.
|
17 |
+
"""
|
18 |
+
if model_name is None:
|
19 |
+
return "N/A"
|
20 |
+
|
21 |
+
# ๋ฌธ์์ด๋ก ๋ณํ (๋ค๋ฅธ ํ์
์ด ์ ๋ฌ๋ ๊ฒฝ์ฐ)
|
22 |
+
model_name_str = str(model_name).strip()
|
23 |
+
|
24 |
+
# MODEL_MAPPING์์ ์ฐพ๊ธฐ (๋์๋ฌธ์ ๊ตฌ๋ถ ์์ด)
|
25 |
+
for key, mapping_value in MODEL_MAPPING.items():
|
26 |
+
if model_name_str.lower() == key.lower():
|
27 |
+
if isinstance(mapping_value, tuple):
|
28 |
+
# ํํ์ธ ๊ฒฝ์ฐ, (ํ์๋ ์ด๋ฆ, ์ธ๋ถ URL)๋ก ์ฌ์ฉ
|
29 |
+
new_name, new_url = mapping_value
|
30 |
+
else:
|
31 |
+
# ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ, ๋ด๋ถ Hugging Face URL๋ก ๊ตฌ์ฑ
|
32 |
+
new_name = mapping_value
|
33 |
+
new_url = f"https://huggingface.co/{new_name}"
|
34 |
+
return model_hyperlink(new_url, new_name)
|
35 |
+
|
36 |
+
# ๋งคํ์ด ์๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ Hugging Face URL ์ฌ์ฉ
|
37 |
+
link = f"https://huggingface.co/{model_name_str}"
|
38 |
+
return model_hyperlink(link, model_name_str)
|
39 |
|
40 |
def styled_error(error):
|
41 |
return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
|
|
|
50 |
return df[columns].notna().all(axis=1)
|
51 |
|
52 |
def has_nan_values(df, columns):
|
53 |
+
return df[columns].isna().any(axis=1)
|