Spaces:
Runtime error
Runtime error
Terry Zhuo commited on
Commit ·
a2d883f
1
Parent(s): af3bf93
update
Browse files13 unmodified lines141516171819207 unmodified lines28293031323334353630 unmodified lines6768697071727374757677787980818283848586878889909192939 unmodified lines10310410510610710810911011111211311411511611711811911 unmodified lines13113213313413513613710 unmodified lines14814915015115215315413 unmodified linesis_running = Falsedef generate_command(jsonl_file, split, subset, save_pass_rate, parallel,min_time_limit, max_as_limit, max_data_limit, max_stack_limit,check_gt_only, no_gt):7 unmodified linescommand.extend(["--split", split, "--subset", subset])if save_pass_rate:command.append("--save_pass_rate")if parallel is not None and parallel != 0:command.extend(["--parallel", str(int(parallel))])30 unmodified linesdef run_bigcodebench(command):global is_runningis_running = Trueyield f"Executing command: {command}\n"process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)for line in process.stdout:yield lineprocess.wait()if process.returncode != 0:yield f"Error: Command exited with status {process.returncode}\n"is_running = Falseyield "Evaluation completed.\n"result_file = find_result_file()if result_file:yield f"Result file found: {result_file}\n"else:yield "No result file found.\n"def stream_logs(command, jsonl_file=None):global is_running9 unmodified linesfor log_line in run_bigcodebench(command):log_content.append(log_line)yield "".join(log_content)with gr.Blocks() as demo:gr.Markdown("# BigCodeBench Evaluator")with gr.Row():jsonl_file = gr.File(label="Upload JSONL file", file_types=[".jsonl"])split = gr.Dropdown(choices=["complete", "instruct"], label="Split", value="complete")subset = gr.Dropdown(choices=["full", "hard"], label="Subset", value="hard")with gr.Row():save_pass_rate = gr.Checkbox(label="Save Pass Rate")parallel = gr.Number(label="Parallel (optional)", precision=0)min_time_limit = gr.Number(label="Min Time Limit", value=1, precision=1)max_as_limit = gr.Number(label="Max AS Limit", value=25*1024, precision=0)11 unmodified lineslog_output = gr.Textbox(label="Execution Logs", lines=20)input_components = [jsonl_file, split, subset, save_pass_rate, parallel,min_time_limit, max_as_limit, max_data_limit, max_stack_limit,check_gt_only, no_gt]10 unmodified linesfor log in stream_logs(command, jsonl_file):yield log, gr.update(value=result_path, label=result_path), gr.update()result_file = find_result_file()if result_file:return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)13 unmodified lines141516171819207 unmodified lines28293031323330 unmodified lines64656667686970717273747576777879808182838485868788899091929394959697989 unmodified lines10810911011111211311411511611711811912012112212311 unmodified lines13513613713813914014110 unmodified lines15215315415515615715813 unmodified linesis_running = Falsedef generate_command(jsonl_file, split, subset, parallel,min_time_limit, max_as_limit, max_data_limit, max_stack_limit,check_gt_only, no_gt):7 unmodified linescommand.extend(["--split", split, "--subset", subset])if parallel is not None and parallel != 0:command.extend(["--parallel", str(int(parallel))])30 unmodified linesdef run_bigcodebench(command):global is_runningwith lock:if is_running:yield "A command is already running. Please wait for it to finish.\n"returnis_running = Truetry:yield f"Executing command: {command}\n"process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)for line in process.stdout:yield lineprocess.wait()if process.returncode != 0:yield f"Error: Command exited with status {process.returncode}\n"yield "Evaluation completed.\n"result_file = find_result_file()if result_file:yield f"Result file found: {result_file}\n"else:yield "No result file found.\n"finally:with lock:is_running = Falsedef stream_logs(command, jsonl_file=None):global is_running9 unmodified linesfor log_line in run_bigcodebench(command):log_content.append(log_line)yield "".join(log_content)with gr.Blocks() as demo:gr.Markdown("# BigCodeBench Evaluator")with gr.Row():jsonl_file = gr.File(label="Upload JSONL file", file_types=[".jsonl"])split = gr.Dropdown(choices=["complete", "instruct"], label="Split", value="complete")subset = gr.Dropdown(choices=["hard"], label="Subset", value="hard")with gr.Row():parallel = gr.Number(label="Parallel (optional)", precision=0)min_time_limit = gr.Number(label="Min Time Limit", value=1, precision=1)max_as_limit = gr.Number(label="Max AS Limit", value=25*1024, precision=0)11 unmodified lineslog_output = gr.Textbox(label="Execution Logs", lines=20)input_components = [jsonl_file, split, subset, parallel,min_time_limit, max_as_limit, max_data_limit, max_stack_limit,check_gt_only, no_gt]10 unmodified linesfor log in stream_logs(command, jsonl_file):yield log, gr.update(value=result_path, label=result_path), gr.update()is_running = Falseresult_file = find_result_file()if result_file:return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
app.py+33-29