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