Terry Zhuo commited on
Commit ·
bb1048a
1
Parent(s): dba3ac5
update
Browse files83 unmodified lines848586878889905 unmodified lines96979899100101102103104105106107108109375 unmodified lines48548648748848949049149249349449549649749849950050150250350450550650750850951051183 unmodified linesreturn filtered_datadef update_display(search_keyword, index, show_solution, show_test):filtered_data = filter_data(DATA, search_keyword)if not filtered_data:5 unmodified linestask_id = filtered_data[index]['task_id']snippet1 = filtered_data[index]['complete_prompt']snippet2 = filtered_data[index]['instruct_prompt']snippet3 = filtered_data[index]['canonical_solution'] if show_solution else ""snippet4 = filtered_data[index]['test'] if show_test else ""return [task_id,snippet1,snippet2,snippet3,snippet4,len(filtered_data),gr.update(maximum=max_index, value=index)375 unmodified linessearch_input = gr.Textbox(label="Search by keyword")count_output = gr.Number(label="Number of filtered items")index_slider = gr.Slider(minimum=0, maximum=len(DATA)-1, step=1, label="Select Index")show_solution = gr.Checkbox(label="Show Solution")show_test = gr.Checkbox(label="Show Test Cases")update_button = gr.Button("Update Display")task_id_output = gr.Textbox(label="Task ID")code_completion = gr.Code(language="python", label="Code Completion")nl_instruction = gr.Code(language="python", label="Natural Language Instruction")solution = gr.Code(language="python", label="Solution")test_cases = gr.Code(language="python", label="Test Cases")update_button.click(update_display,inputs=[search_input, index_slider, show_solution, show_test],outputs=[task_id_output, code_completion, nl_instruction, solution, test_cases, count_output, index_slider])# Initial loaddemo.load(update_display,inputs=[search_input, index_slider, show_solution, show_test],outputs=[task_id_output, code_completion, nl_instruction, solution, test_cases, count_output, index_slider])with gr.TabItem("🚀 Request", id=4):83 unmodified lines848586878889905 unmodified lines96979899100101102103104105106107108109375 unmodified lines48548648748848949049149249349449549649749849950050150250350450550650750850951051183 unmodified linesreturn filtered_datadef update_display(search_keyword, index, show_test):filtered_data = filter_data(DATA, search_keyword)if not filtered_data:5 unmodified linestask_id = filtered_data[index]['task_id']snippet1 = filtered_data[index]['complete_prompt']snippet2 = filtered_data[index]['instruct_prompt']# snippet3 = filtered_data[index]['canonical_solution'] if show_solution else ""snippet4 = filtered_data[index]['test'] if show_test else ""return [task_id,snippet1,snippet2,# snippet3,snippet4,len(filtered_data),gr.update(maximum=max_index, value=index)375 unmodified linessearch_input = gr.Textbox(label="Search by keyword")count_output = gr.Number(label="Number of filtered items")index_slider = gr.Slider(minimum=0, maximum=len(DATA)-1, step=1, label="Select Index")# show_solution = gr.Checkbox(label="Show Solution")show_test = gr.Checkbox(label="Show Test Cases")update_button = gr.Button("Update Display")task_id_output = gr.Textbox(label="Task ID")code_completion = gr.Code(language="python", label="Code Completion")nl_instruction = gr.Code(language="python", label="Natural Language Instruction")# solution = gr.Code(language="python", label="Solution")test_cases = gr.Code(language="python", label="Test Cases")update_button.click(update_display,inputs=[search_input, index_slider, show_test],outputs=[task_id_output, code_completion, nl_instruction, test_cases, count_output, index_slider])# Initial loaddemo.load(update_display,inputs=[search_input, index_slider, show_test],outputs=[task_id_output, code_completion, nl_instruction, test_cases, count_output, index_slider])with gr.TabItem("🚀 Request", id=4):
app.py+9-9