"""Interface for labeling concepts in images. """ import gradio as gr from src import global_variables def get_votes( split, profile: gr.OAuthProfile ): username = profile.username vote_list = [] for i,s in enumerate(global_variables.all_metadata[split]): if s["id"] in global_variables.all_votes and username in global_variables.all_votes[s["id"]]: vote_list.append(f'[{i}]: {global_variables.all_votes[s["id"]][username]}') return "\n".join(vote_list) with gr.Blocks() as interface: with gr.Row(): with gr.Column(): with gr.Group(): gr.Markdown( "## # Selection", ) split = gr.Radio( label="Split", choices=["train", "test"], value="train", ) with gr.Row(): gr.LoginButton() get_button = gr.Button( value="Get My Votes", ) with gr.Column(): votes = gr.TextArea( label="Votes", lines=1, ) get_button.click( get_votes, inputs=[split], outputs=[votes] )