terryyz commited on
Commit
180a1c8
1 Parent(s): eb84112

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -57
app.py CHANGED
@@ -523,71 +523,71 @@ with main_block as demo:
523
  outputs=[task_id_output, code_completion, nl_instruction, test_cases, count_output, index_slider]
524
  )
525
 
526
- with gr.TabItem("🛠️ Code Execution (Beta)", id=5):
527
- gr.Markdown("""\
528
- ### Hard Set Ground Truth Pass Rate: 100%
529
- ### Full Set Ground Truth Pass Rate: 99.6%
530
-
531
- ### Note: The code execution session is no longer maintained. Please `pip install -U bigcodebench` and refer to [BigCodeBench Repository](https://github.com/bigcode-project/bigcodebench).
532
- """)
533
- with gr.Row():
534
- jsonl_file = gr.File(label="Upload JSONL file", file_types=[".jsonl"])
535
- split = gr.Dropdown(choices=["complete", "instruct"], label="Split", value="complete")
536
- subset = gr.Dropdown(choices=["hard", "full"], label="Subset", value="hard")
537
 
538
- with gr.Row():
539
- parallel = gr.Number(label="Parallel (optional)", precision=0)
540
- min_time_limit = gr.Number(label="Min Time Limit", value=1, precision=1)
541
- max_as_limit = gr.Number(label="Max AS Limit", value=25*1024, precision=0)
542
 
543
- with gr.Row():
544
- max_data_limit = gr.Number(label="Max Data Limit", value=25*1024, precision=0)
545
- max_stack_limit = gr.Number(label="Max Stack Limit", value=10, precision=0)
546
- check_gt_only = gr.Checkbox(label="Check GT Only", value=False, visible=False)
547
- no_gt = gr.Checkbox(label="No GT", value=False, visible=False)
548
 
549
- command_output = gr.Textbox(label="Command", value=default_command, interactive=False)
550
- with gr.Row():
551
- submit_btn = gr.Button("Run Evaluation")
552
- download_btn = gr.DownloadButton(label="Download Result", visible=False)
553
- log_output = gr.Textbox(label="Execution Logs", lines=20)
554
 
555
- input_components = [
556
- jsonl_file, split, subset, parallel,
557
- min_time_limit, max_as_limit, max_data_limit, max_stack_limit,
558
- check_gt_only, no_gt
559
- ]
560
 
561
- for component in input_components:
562
- component.change(generate_command, inputs=input_components, outputs=command_output)
563
 
564
 
565
- def start_evaluation(command, jsonl_file, subset, split):
566
- lock.acquire()
567
- if jsonl_file is not None:
568
- result_path = os.path.basename(jsonl_file.name).replace(".jsonl", "_eval_results.json")
569
- else:
570
- result_path = None
571
-
572
- for log in stream_logs(command, jsonl_file):
573
- if jsonl_file is not None and jsonl_file.name.endswith(".jsonl"):
574
- yield log, gr.update(value=result_path, label=result_path, visible=True), gr.update(visible=False)
575
- else:
576
- yield log, gr.update(), gr.update()
577
- lock.release()
578
- result_file = find_result_file()
579
- if result_file:
580
- return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
581
- # gr.Button(visible=False)#,
582
- # gr.DownloadButton(label="Download Result", value=result_file, visible=True))
583
- else:
584
- return gr.update(label="Evaluation completed. No result file found."), gr.update(value=result_path)
585
- # gr.Button("Run Evaluation", visible=True),
586
- # gr.DownloadButton(visible=False))
587
 
588
- submit_btn.click(start_evaluation,
589
- inputs=[command_output, jsonl_file, subset, split],
590
- outputs=[log_output, download_btn, submit_btn])
591
 
592
  with gr.TabItem("🚀 Request", id=4):
593
  gr.Markdown(SUBMISSION_TEXT_3)
 
523
  outputs=[task_id_output, code_completion, nl_instruction, test_cases, count_output, index_slider]
524
  )
525
 
526
+ # with gr.TabItem("🛠️ Code Execution (Beta)", id=5):
527
+ # gr.Markdown("""\
528
+ # ### Hard Set Ground Truth Pass Rate: 100%
529
+ # ### Full Set Ground Truth Pass Rate: 99.6%
530
+
531
+ # ### Note: The code execution session is no longer maintained. Please `pip install -U bigcodebench` and refer to [BigCodeBench Repository](https://github.com/bigcode-project/bigcodebench).
532
+ # """)
533
+ # with gr.Row():
534
+ # jsonl_file = gr.File(label="Upload JSONL file", file_types=[".jsonl"])
535
+ # split = gr.Dropdown(choices=["complete", "instruct"], label="Split", value="complete")
536
+ # subset = gr.Dropdown(choices=["hard", "full"], label="Subset", value="hard")
537
 
538
+ # with gr.Row():
539
+ # parallel = gr.Number(label="Parallel (optional)", precision=0)
540
+ # min_time_limit = gr.Number(label="Min Time Limit", value=1, precision=1)
541
+ # max_as_limit = gr.Number(label="Max AS Limit", value=25*1024, precision=0)
542
 
543
+ # with gr.Row():
544
+ # max_data_limit = gr.Number(label="Max Data Limit", value=25*1024, precision=0)
545
+ # max_stack_limit = gr.Number(label="Max Stack Limit", value=10, precision=0)
546
+ # check_gt_only = gr.Checkbox(label="Check GT Only", value=False, visible=False)
547
+ # no_gt = gr.Checkbox(label="No GT", value=False, visible=False)
548
 
549
+ # command_output = gr.Textbox(label="Command", value=default_command, interactive=False)
550
+ # with gr.Row():
551
+ # submit_btn = gr.Button("Run Evaluation")
552
+ # download_btn = gr.DownloadButton(label="Download Result", visible=False)
553
+ # log_output = gr.Textbox(label="Execution Logs", lines=20)
554
 
555
+ # input_components = [
556
+ # jsonl_file, split, subset, parallel,
557
+ # min_time_limit, max_as_limit, max_data_limit, max_stack_limit,
558
+ # check_gt_only, no_gt
559
+ # ]
560
 
561
+ # for component in input_components:
562
+ # component.change(generate_command, inputs=input_components, outputs=command_output)
563
 
564
 
565
+ # def start_evaluation(command, jsonl_file, subset, split):
566
+ # lock.acquire()
567
+ # if jsonl_file is not None:
568
+ # result_path = os.path.basename(jsonl_file.name).replace(".jsonl", "_eval_results.json")
569
+ # else:
570
+ # result_path = None
571
+
572
+ # for log in stream_logs(command, jsonl_file):
573
+ # if jsonl_file is not None and jsonl_file.name.endswith(".jsonl"):
574
+ # yield log, gr.update(value=result_path, label=result_path, visible=True), gr.update(visible=False)
575
+ # else:
576
+ # yield log, gr.update(), gr.update()
577
+ # lock.release()
578
+ # result_file = find_result_file()
579
+ # if result_file:
580
+ # return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
581
+ # # gr.Button(visible=False)#,
582
+ # # gr.DownloadButton(label="Download Result", value=result_file, visible=True))
583
+ # else:
584
+ # return gr.update(label="Evaluation completed. No result file found."), gr.update(value=result_path)
585
+ # # gr.Button("Run Evaluation", visible=True),
586
+ # # gr.DownloadButton(visible=False))
587
 
588
+ # submit_btn.click(start_evaluation,
589
+ # inputs=[command_output, jsonl_file, subset, split],
590
+ # outputs=[log_output, download_btn, submit_btn])
591
 
592
  with gr.TabItem("🚀 Request", id=4):
593
  gr.Markdown(SUBMISSION_TEXT_3)