openfree commited on
Commit
ec05e33
ยท
verified ยท
1 Parent(s): 09776c0

Update src/display/formatting.py

Browse files
Files changed (1) hide show
  1. 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
- global MODEL_MAPPING # ์ „์—ญ๋ณ€์ˆ˜ MODEL_MAPPING์„ ์‚ฌ์šฉ
14
- if model_name in MODEL_MAPPING:
15
- mapping_value = MODEL_MAPPING[model_name]
16
- if isinstance(mapping_value, tuple):
17
- # ํŠœํ”Œ์ธ ๊ฒฝ์šฐ, (ํ‘œ์‹œ๋  ์ด๋ฆ„, ์™ธ๋ถ€ URL)๋กœ ์‚ฌ์šฉ
18
- new_name, new_url = mapping_value
19
- else:
20
- # ๋ฌธ์ž์—ด์ธ ๊ฒฝ์šฐ, ๋‚ด๋ถ€ Hugging Face URL๋กœ ๊ตฌ์„ฑ
21
- new_name = mapping_value
22
- new_url = f"https://huggingface.co/{new_name}"
23
- return model_hyperlink(new_url, new_name)
24
- else:
25
- link = f"https://huggingface.co/{model_name}"
26
- return model_hyperlink(link, model_name)
 
 
 
 
 
 
 
 
 
 
 
 
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)