MCPcopy Create free account
hub / github.com/Speakn0w/RealChart2Code / save_score_result

Function save_score_result

RealChart2Code_eval/evaluate_task1.py:666–714  ·  view source on GitHub ↗
(task_info: Dict, evaluation: Dict, raw_response: str, plot_file: Path, 
                     results_dir: Path, generation_model: str, evaluation_model: str, 
                     execution_success: bool, execution_message: str)

Source from the content-addressed store, hash-verified

664
665
666def save_score_result(task_info: Dict, evaluation: Dict, raw_response: str, plot_file: Path,
667 results_dir: Path, generation_model: str, evaluation_model: str,
668 execution_success: bool, execution_message: str) -> Path:
669
670
671 task_dir = task_info['data_directory'].name
672 task_result_dir = results_dir / task_dir
673 task_result_dir.mkdir(exist_ok=True)
674
675
676 difficulty = task_info['difficulty']
677 is_multi = task_info['is_multi']
678 score_filename = f"score_{difficulty}_mul.json" if is_multi else f"score_{difficulty}.json"
679
680
681 overall_score = calculate_overall_score(evaluation)
682
683
684 result = {
685 "generation_model": generation_model,
686 "evaluation_model": evaluation_model,
687 "task_file": str(task_info['task_file']),
688 "category": task_info['category'],
689 "instruction": task_info['instruction'],
690 "difficulty": difficulty,
691 "is_multi": is_multi,
692 "timestamp": datetime.now().isoformat(),
693
694
695 "execution_success": execution_success,
696 "execution_message": execution_message,
697 "code_generated": bool(task_info.get('code')),
698 "plot_generated": plot_file is not None,
699
700
701 "evaluation": evaluation,
702 "overall_score": overall_score,
703 "raw_response": raw_response
704 }
705
706
707 if plot_file:
708 result["plot_file"] = str(plot_file)
709
710 score_file = task_result_dir / score_filename
711 with open(score_file, 'w', encoding='utf-8') as f:
712 json.dump(result, f, ensure_ascii=False, indent=2)
713
714 return score_file
715
716
717def prepare_task_info(task_file: Path, max_data_rows: int) -> Optional[Dict]:

Callers 1

Calls 1

calculate_overall_scoreFunction · 0.70

Tested by

no test coverage detected