paper-central / author_leaderboard_tab.py
IAMJB's picture
Leaderboard
bc87bb9
raw
history blame
976 Bytes
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("## Author Leaderboard")
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]
)