Spaces:
Running
Running
File size: 2,252 Bytes
1c919b3 1757118 1c919b3 1757118 1c919b3 |
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 |
import json
with open("model_info.json", "r") as f:
model_info = json.load(f)
def make_clickable_model(model_name):
global model_info
modified_model_name = model_name
if model_name in model_info:
is_open_model = model_info[model_name]["hf_model_id"].startswith("http")
is_open_model = model_info[model_name].get("open", False)
if not is_open_model:
link = model_info[model_name]["hf_model_id"]
modified_model_name = f'π <a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_info[model_name]["pretty_name"]}</a>'
else:
link = f"https://huggingface.co./{model_info[model_name]['hf_model_id']}"
modified_model_name = f'π <a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_info[model_name]["pretty_name"]}</a>'
if "Neo-7B" in modified_model_name:
# models that are fully open source
modified_model_name = modified_model_name.replace("π", "ππ")
hidden = model_info[model_name].get("hidden", False)
if hidden:
modified_model_name = f'β {modified_model_name}'
if "π¨</a>" in modified_model_name:
modified_model_name = modified_model_name.replace(' π¨</a>', '</a> π¨')
# if model_name in ["gpt-4-turbo-2024-04-09", "Llama-2-70b-chat-hf", "claude-3-haiku-20240307"]:
# modified_model_name = modified_model_name.replace('style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;"', 'style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted; font-weight: bold; background-color: var(--link-background-color);"')
return modified_model_name
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>"
|