| import json | |
| def load_model(config_path="model_config.json"): | |
| with open(config_path) as f: | |
| return json.load(f) | |
| def predict_length(gt_value, config): | |
| coef = config["coefficients"] | |
| if config["model_type"] == "log_log_power_regression": | |
| return coef["a"] * (gt_value ** coef["b"]) | |
| else: | |
| return coef["intercept"] + coef["slope"] * gt_value | |
| if __name__ == "__main__": | |
| cfg = load_model() | |
| gt = float(input("Masukkan nilai GT: ")) | |
| print("Prediksi Length:", predict_length(gt, cfg)) | |