#!/bin/bash
#
# 根据 evaluation_report.json 自动生成单模型 Markdown 评测报告
#
# 用法:
#   bash eval_tools/model_comparison/gen_eval_report.sh <evaluation_report.json>
#   bash eval_tools/model_comparison/gen_eval_report.sh <evaluation_report.json> [--output <输出路径>] [--model "模型名"] [--date YYYY-MM-DD]
#
# 示例:
#   bash eval_tools/model_comparison/gen_eval_report.sh \
#       evaluation_results/.../evaluation_report.json
#
#   bash eval_tools/model_comparison/gen_eval_report.sh \
#       evaluation_results/.../evaluation_report.json \
#       --model yolov5s-300w-newdata-cncap \
#       --date 2026-02-28

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
export PYTHONPATH="${PROJECT_ROOT}:${PYTHONPATH}"

if [ $# -eq 0 ]; then
    echo "用法: bash $0 <evaluation_report.json> [选项...]"
    echo ""
    echo "选项:"
    echo "  --output/-o <路径>      输出 Markdown 文件路径（默认：JSON 同目录下的 EVALUATION_REPORT.md）"
    echo "  --model <名称>          模型名称（默认从目录名推断）"
    echo "  --date <YYYY-MM-DD>     评测日期（默认：今天）"
    exit 1
fi

python "${SCRIPT_DIR}/generate_eval_report.py" "$@"
