Spaces:
Runtime error
Runtime error
File size: 1,272 Bytes
405b0bd de554eb 405b0bd |
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 |
"""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", "validation", "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]
)
|