import json
import os
from datetime import datetime
import gradio as gr
import pandas as pd
from envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
custom_css = """
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn&display=swap');
body, .gradio-container, .gr-button, .gr-input, .gr-slider, .gr-dropdown, .gr-markdown {
font-family: 'Vazirmatn', sans-serif !important;
}
.markdown-text {
font-size: 16px !important;
}
#models-to-add-text {
font-size: 18px !important;
}
#citation-button span {
font-size: 16px !important;
}
#citation-button textarea {
font-size: 16px !important;
}
#citation-button > label > button {
margin: 6px;
transform: scale(1.3);
}
#leaderboard-table {
margin-top: 15px;
text-align: center;
}
#leaderboard-table,
#leaderboard-table th,
#leaderboard-table td {
text-align: center;
vertical-align: middle;
border-collapse: collapse;
}
#leaderboard-table td:first-child,
#leaderboard-table th:first-child {
text-align: left;
max-width: 600px;
}
table > thead {
white-space: normal;
}
table > thead th,
table > tbody td {
text-align: center;
vertical-align: middle;
}
table > tbody td:first-child {
text-align: left;
max-width: 600px;
}
#leaderboard-table-lite {
margin-top: 15px;
}
#search-bar-table-box > div:first-child {
background: none;
border: none;
}
#search-bar {
padding: 0px;
}
.tab-buttons button {
font-size: 20px;
}
#scale-logo {
border-style: none !important;
box-shadow: none;
display: block;
margin-left: auto;
margin-right: auto;
max-width: 600px;
}
#scale-logo .download {
display: none;
}
#filter_type {
border: 0;
padding-left: 0;
padding-top: 0;
}
#filter_type label {
display: flex;
}
#filter_type label > span {
margin-top: var(--spacing-lg);
margin-right: 0.5em;
}
#filter_type label > .wrap {
width: 103px;
}
#filter_type label > .wrap .wrap-inner {
padding: 2px;
}
#filter_type label > .wrap .wrap-inner input {
width: 1px;
}
#filter-columns-type {
border: 0;
padding: 0.5;
}
#filter-columns-size {
border: 0;
padding: 0.5;
}
#box-filter > .form {
border: 0;
}
"""
ABOUT_TEXT = f"""
# Persian Text Embedding Benchmark (v1.0.0)
"""
SUBMIT_TEXT = """## Submitting a Model for Evaluation
> To submit your open-source model for evaluation, follow these steps:
>
> 1. **Ensure your model is on Hugging Face**: Your model must be publicly available on [Hugging Face](https://huggingface.co/).
>
> 2. **Submit Request**: Send a request with your model's Hugging Face identifier.
>
> 3. **Manual Queue**: Please note that the evaluation process is currently handled manually. Submissions will be queued and processed as soon as possible.
>
> 4. **Results**: Once the evaluation is complete, your model’s results will be updated on the leaderboard.
>
> We appreciate your patience and contributions to the Persian LM ecosystem!
"""
PART_LOGO = """