Spaces:
Running
Running
File size: 1,946 Bytes
064d8d7 f710cf8 064d8d7 4e0c371 064d8d7 4e0c371 064d8d7 |
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import gradio as gr
from df.author_leaderboard_contrib import AuthorLeaderboardContrib
def author_resource_leaderboard_tab():
# Initialize the AuthorLeaderboardContrib class
leaderboard = AuthorLeaderboardContrib()
with gr.Row():
gr.Markdown(
"""
## Contributors Leaderboard
The leaderboard centers on **artifact creators** who have developed models, datasets, or spaces associated with papers, regardless of whether they authored the original papers. It ranks contributors based on the total number of artifacts they've created that are linked to papers, as well as metrics like likes and downloads.
"""
)
with gr.Row():
author_search_input = gr.Textbox(
label="Search by Contributor Name",
placeholder="Enter author name...",
lines=1,
)
entity_type_filter = gr.Radio(
label="Entity Type",
choices=['All', 'user', 'org'],
value='All',
)
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 function
def update_leaderboard(author_name, entity_type):
return leaderboard.filter(author_name, entity_type)
inputs = [author_search_input, entity_type_filter]
outputs = [leaderboard_component]
# Set up the interactions
author_search_input.change(
update_leaderboard,
inputs=inputs,
outputs=outputs,
api_name=False,
)
entity_type_filter.change(
update_leaderboard,
inputs=inputs,
outputs=outputs,
api_name=False,
)
|