Spaces:
Running
Running
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 = not model_info[model_name]["hf_model_id"].startswith("http") | |
is_open_model = model_info[model_name].get("open", is_open_model) | |
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>" | |