#!/bin/bash

# Default model path
MODEL_PATH="model/constant_predictor.joblib"

if [ -z "$1" ]; then
    echo "Usage: ./run_predict.sh <TJA_FILE_PATH> [oni|edit]"
    echo "Example: ./run_predict.sh datas/tja/1.tja oni"
    exit 1
fi

TJA_FILE=$1
DIFF=${2:-oni}

if [ ! -f "$TJA_FILE" ]; then
    echo "Error: TJA file not found at $TJA_FILE"
    exit 1
fi

if [ ! -f "$MODEL_PATH" ]; then
    echo "Error: Model not found at $MODEL_PATH. Please run ./run_pipeline.sh first."
    exit 1
fi

# Run prediction
bun run src/predict.ts "$MODEL_PATH" "$TJA_FILE" "$DIFF"
