File size: 4,186 Bytes
e2473e2
 
cdf268e
e2473e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import os

import gradio as gr  # type: ignore[import]

from src.content import (INTRODUCTION_TEXT, INTRODUCTION_TITLE,
                         LEADERBOARD_TEXT, LEADERBOARD_TITLE,
                         SUBMISSION_TEXT_FILES, SUBMISSION_TEXT_INTRO,
                         SUBMISSION_TEXT_METADATA, SUBMISSION_TEXT_SUBMIT,
                         SUBMISSION_TEXT_TASK, SUBMISSION_TITLE)
from src.get_results_for_task import get_results_for_task_stub
from src.submission_uploader import SubmissionUploader
from src.tasks import TASKS_DESCRIPTIONS, TASKS_PRETTY, TASKS_PRETTY_REVERSE

submission_uploader = SubmissionUploader(os.environ["DATASET_ID"])


with gr.Blocks() as demo:
    gr.HTML(INTRODUCTION_TITLE)
    gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")

    gr.HTML(LEADERBOARD_TITLE)
    gr.Markdown(LEADERBOARD_TEXT, elem_classes="markdown-text")

    with gr.Tabs():
        for task in TASKS_PRETTY_REVERSE:
            with gr.TabItem(task):
                with gr.Row():
                    gr.Markdown(TASKS_DESCRIPTIONS[task])

                leaderboard_table = gr.components.Dataframe(
                    value=get_results_for_task_stub(task), interactive=False
                )

    gr.HTML(SUBMISSION_TITLE)
    gr.Markdown(SUBMISSION_TEXT_INTRO, elem_classes="markdown-text")

    with gr.Accordion("🚀 Submit new results"):
        gr.Markdown(SUBMISSION_TEXT_TASK, elem_classes="markdown-text")
        task = gr.Radio(TASKS_PRETTY_REVERSE.keys(), label="Task")

        gr.Markdown(SUBMISSION_TEXT_METADATA, elem_classes="markdown-text")
        with gr.Row():
            with gr.Column():
                model_folder_textbox = gr.Textbox(
                    label="Model Folder",
                    placeholder="How to call a folder related to this submission in our results dataset.",
                )
                model_name_textbox = gr.Textbox(
                    label="Model Name",
                    placeholder="How to display model's name on the leaderboard.",
                )
                model_availability_textbox = gr.Textbox(
                    label="Availability",
                    placeholder="Information about the model's availability and licensing.",
                )
                context_size_textbox = gr.Textbox(
                    label="Context Size",
                    placeholder="Context size (in tokens) used for the submission.",
                )
            with gr.Column():
                submitted_by_textbox = gr.Textbox(
                    label="Submitted By",
                    placeholder="Who submitted the model, how it will be displayed on the leaderboard.",
                )
                contact_textbox = gr.Textbox(
                    label="Contact Information",
                    placeholder="How Long Code Arena team can contact you in case of any questions (won't go to public dataset).",
                )
                comment_textbox = gr.Textbox(
                    label="Comment",
                    placeholder="Any comments you have for Long Code Arena team (optional, won't go to public dataset).",
                )
                url_textbox = gr.Textbox(
                    label="Relevant URLs",
                    placeholder="URLs to relevant resources (preprint/blogpost/code/etc.) with "
                    "additional details about your submission.",
                )

        gr.Markdown(SUBMISSION_TEXT_FILES, elem_classes="markdown-text")
        file_output = gr.File(file_count="multiple")

        gr.Markdown(SUBMISSION_TEXT_SUBMIT, elem_classes="markdown-text")
        submit_button = gr.Button("Submit")
        submission_result = gr.Markdown()
        submit_button.click(
            submission_uploader.upload_files,
            [
                task,
                model_folder_textbox,
                model_name_textbox,
                model_availability_textbox,
                url_textbox,
                context_size_textbox,
                submitted_by_textbox,
                file_output,
            ],
            submission_result,
        )

if __name__ == "__main__":
    demo.launch()