Spaces:
Running
Running
import os | |
import base64 | |
import gradio as gr | |
import pandas as pd | |
from apscheduler.schedulers.background import BackgroundScheduler | |
from src.about import ( | |
CITATION_BUTTON_LABEL, | |
CITATION_BUTTON_TEXT, | |
) | |
from src.display.css_html_js import custom_css | |
from src.envs import API, REPO_ID | |
current_dir = os.path.dirname(os.path.realpath(__file__)) | |
with open(os.path.join(current_dir, "images/pb_logo.png"), "rb") as image_file: | |
main_logo = base64.b64encode(image_file.read()).decode('utf-8') | |
def restart_space(): | |
API.restart_space(repo_id=REPO_ID) | |
TITLE=""" | |
# ProteinBench: A Holistic Evaluation of Protein Foundation Models""" | |
INTRO_TEXT=""" | |
Recent years have witnessed a surge in the development of protein foundation models, | |
significantly improving performance in protein prediction and generative tasks | |
ranging from 3D structure prediction and protein design to conformational dynamics. | |
However, the capabilities and limitations associated with these models remain poorly understood due to the absence of a unified evaluation framework. | |
To fill this gap, we introduce <b>ProteinBench</b>, | |
a holistic evaluation framework designed to enhance the transparency of protein foundation models. | |
Our approach consists of three key components: | |
(i) A taxonomic classification of tasks that broadly encompass the main challenges in the protein domain, | |
based on the relationships between different protein modalities; | |
(ii) A multi-metric evaluation approach that assesses performance across four key dimensions: quality, novelty, diversity, and robustness; | |
and (iii) In-depth analyses from various user objectives, providing a holistic view of model performance. | |
Our comprehensive evaluation of protein foundation models reveals several key findings that shed light on their current capabilities and limitations. | |
To promote transparency and facilitate further research, we release the evaluation dataset, code, and a public leaderboard publicly for further analysis | |
and a general modular toolkit. We intend for ProteinBench to be a living benchmark for establishing a standardized, | |
in-depth evaluation framework for protein foundation models, driving their development and application while fostering collaboration within the field. | |
## [Paper](https://www.arxiv.org/pdf/2409.06744) | [Website](https://proteinbench.github.io/) | |
""" | |
# ### Space initialisation | |
demo = gr.Blocks(css=custom_css) | |
with demo: | |
with gr.Row(): | |
with gr.Column(scale=6): | |
gr.Markdown(TITLE) | |
with gr.Row(): | |
with gr.Column(scale=6): | |
gr.Markdown(INTRO_TEXT) | |
with gr.Column(scale=1): | |
gr.HTML(f'<img src="data:image/jpeg;base64,{main_logo}" style="width:16em;vertical-align: middle"/>') | |
with gr.Tabs(elem_classes="tab-buttons") as tabs: | |
with gr.TabItem("π Inverse Folding Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/inverse_folding.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Structure Design Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/structure_design.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Sequence Design Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/sequence_design.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Sequence-Structure Co-Design Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/co_design.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Motif Scaffolding Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/motif_scaffolding.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Antibody Design Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/antibody_design.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Protein Folding Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/protein_folding.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Multi-State Prediction Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/multi_state_prediction.csv'), | |
height=1000, | |
) | |
with gr.TabItem("π Conformation Prediction Leaderboard"): | |
with gr.Row(): | |
inverse_folding_table = gr.DataFrame( | |
pd.read_csv('data/conformation_prediction.csv'), | |
height=1000, | |
) | |
with gr.Row(): | |
with gr.Accordion("π Citation", open=True): | |
citation_button = gr.Textbox( | |
value=CITATION_BUTTON_TEXT, | |
label=CITATION_BUTTON_LABEL, | |
lines=9, | |
elem_id="citation-button", | |
show_copy_button=True, | |
) | |
scheduler = BackgroundScheduler() | |
scheduler.add_job(restart_space, "interval", seconds=1800) | |
scheduler.start() | |
demo.queue(default_concurrency_limit=40).launch() |