Spaces:
Running
Running
File size: 3,512 Bytes
6c858ba 5bbddad 4379767 b343c97 4d944cb 6c858ba 5bbddad b343c97 6c858ba 4379767 6c858ba 7430bfa b190717 6c858ba b190717 6c858ba 8cdce17 41936a6 c36279d 8cdce17 41936a6 c36279d 41936a6 8cdce17 4d944cb 6c858ba ede7356 6c858ba |
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 59 60 61 62 |
import gradio as gr
from chain_data import sync_chain
from leaderboard import create_leaderboard, create_dropdown, create_baseline
from model_demo import create_demo
from submissions import create_submissions, create_duplicate_submissions_plot, DROPDOWN_OPTIONS
from validator_states import create_validator_states
from validator_weights import create_weights
from wandb_data import sync
def main():
sync_chain()
sync()
with gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}", fill_height=True, fill_width=True) as app:
with gr.Tab("Leaderboard") as leaderboard_tab:
dropdown = gr.Dropdown()
dropdown.attach_load_event(lambda: create_dropdown(), None)
baseline_dataframe = gr.Dataframe()
baseline_dataframe.attach_load_event(lambda uid: create_baseline(uid), None, inputs=[dropdown])
leaderboard_tab.select(lambda uid: create_baseline(uid), inputs=[dropdown], outputs=[baseline_dataframe])
dropdown.change(lambda uid: create_baseline(uid), inputs=[dropdown], outputs=[baseline_dataframe])
leaderboard_dataframe = gr.Dataframe()
leaderboard_dataframe.attach_load_event(lambda uid: create_leaderboard(uid), None, inputs=[dropdown])
leaderboard_tab.select(lambda uid: create_leaderboard(uid), inputs=[dropdown], outputs=[leaderboard_dataframe])
dropdown.change(lambda uid: create_leaderboard(uid), inputs=[dropdown], outputs=[leaderboard_dataframe])
with gr.Tab("Validator States") as validator_states_tab:
validator_states_dataframe = gr.Dataframe()
validator_states_dataframe.attach_load_event(lambda: create_validator_states(), None)
validator_states_tab.select(lambda: create_validator_states(), [], [validator_states_dataframe])
with gr.Tab("Validator Weights") as validator_weights_tab:
include_inactive_checkbox = gr.Checkbox(False, label="Include Inactive", container=False)
validator_weights_dataframe = gr.Dataframe()
validator_weights_dataframe.attach_load_event(lambda include_inactive: create_weights(include_inactive), None, [include_inactive_checkbox])
validator_weights_tab.select(lambda include_inactive: create_weights(include_inactive), [include_inactive_checkbox], [validator_weights_dataframe])
include_inactive_checkbox.change(lambda include_inactive: create_weights(include_inactive), [include_inactive_checkbox], [validator_weights_dataframe])
with gr.Tab("Submissions") as submissions_tab:
filter_dropdown = gr.Dropdown(choices=DROPDOWN_OPTIONS, value=DROPDOWN_OPTIONS, label="Filter", container=False, multiselect=True)
submissions_dataframe = gr.Dataframe()
submissions_dataframe.attach_load_event(lambda include_blacklisted: create_submissions(include_blacklisted), None, [filter_dropdown])
submissions_tab.select(lambda submission_filter: create_submissions(submission_filter), [filter_dropdown], [submissions_dataframe])
filter_dropdown.change(lambda submission_filter: create_submissions(submission_filter), [filter_dropdown], [submissions_dataframe])
duplicate_submissions_plot = gr.Plot()
duplicate_submissions_plot.attach_load_event(lambda: create_duplicate_submissions_plot(), None)
with gr.Tab("Model Demo"):
create_demo()
app.launch()
if __name__ == "__main__":
main()
|