Spaces:
Running
Running
import gradio as gr | |
from df.author_leaderboard import AuthorLeaderboard | |
def author_leaderboard_tab(): | |
# Initialize the AuthorLeaderboard class | |
leaderboard = AuthorLeaderboard() | |
with gr.Row(): | |
gr.Markdown( | |
""" | |
## Authors Leaderboard | |
The leaderboard focuses on <b>paper authors</b> whose works have attracted artifacts (models, datasets, spaces) from the community, even if they did not create these artifacts themselves. It ranks authors based on the total number of artifacts associated with their papers, along with other metrics like the number of papers they have, upvotes, comments, and average artifacts per paper. | |
""") | |
with gr.Row(): | |
author_search_input = gr.Textbox( | |
label="Search by Author Name", | |
placeholder="Enter author name...", | |
lines=1, | |
) | |
with gr.Row(): | |
leaderboard_component = gr.Dataframe( | |
label="Leaderboard", | |
value=leaderboard.df_prettified, | |
datatype=[leaderboard.DATATYPES[column] for column in leaderboard.COLUMNS_ORDER], | |
row_count=(0, "dynamic"), | |
interactive=False, | |
max_height=1000, | |
wrap=True, | |
) | |
# Define the interaction | |
author_search_input.change( | |
leaderboard.filter, | |
inputs=[author_search_input], | |
outputs=[leaderboard_component], | |
api_name=False, | |
) | |