File size: 2,576 Bytes
3a0a132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
        '''
        use extract, or use ppl
        '''
        question=gr.Textbox(label="input question", placeholder='input your question here...')
        answer_index=gr.Textbox(label="right answer index", placeholder='index for right anser here, start with 0')#TODO add multiple choices, 
        # choices=gr.Textbox(placeholder='input your other choices here...')
        
        btn_list=[]
        button_limit=10
        with gr.Row():
            for i in range(button_limit):
                btn = gr.Textbox(visible=True)
                # btn = gr.Textbox(visible=False)
                btn_list.append(btn)
        b = gr.Button("add_one_choice")

        print(f'len(btn_list): {len(btn_list)},btn_list:{btn_list}')

        
        # test_button=gr.Button('test').click(harness_eval())# TODO figure out the input and output

        answer_type=gr.Dropdown(label="answer type", choices=['extract', 'ppl'])
        #TODO add the model and its score
        answer_label=gr.Label('the answers\'s detail')# RETURN the answer and its score,in the form of dic{str: float}

        # test_question_button=gr.Button('test question').click(harness_eval,inputs=[question, '&&&&&&'.join(btn_list), answer_index ,answer_type],outputs=[answer_label])
        test_question_button=gr.Button('test question').click(harness_eval,inputs=[question, *btn_list, answer_index ,answer_type],outputs=[answer_label])

        forecast_q='A Ukrainian counteroffensive began in 2023, though territorial gains by November 2023 were limited (Economist, BBC, Newsweek). The question will be suspended on 31 July 2024 and the outcome determined using data as reported in the Brookings Institution\'s "Ukraine Index" (Brookings Institution - Ukraine Index, see "Percentage of Ukraine held by Russia" chart). If there is a discrepancy between the chart data and the downloaded data (see "Get the data" within the "NET TERRITORIAL GAINS" chart border), the downloaded data will be used for resolution.'
        answer_list=['Less than 5%','At least 5%, but less than 10%','At least 10%, but less than 15%','At least 15%, but less than 20%','20% or more' ]
         
        gr.Examples([
                    [forecast_q, '0']
                     ],
                    [question, answer_index])

        date_time_input = gr.Textbox(label="the date when the text is generated")#TODO add date time input
        description_input = gr.Textbox(label="description of the text")
        submit_button = gr.Button("submit a post or record").click()

        #TODO add the model and its score