Download Phase_0/predict.py from JullMol/POSEIDON: direct link, hf CLI and curl.
- Browser
- Download file 527 Bytes
-
https://huggingface.co/JullMol/POSEIDON/resolve/main/Phase_0/predict.py
- Command line
-
hf download hf://JullMol/POSEIDON/Phase_0/predict.py
-
curl -L -o predict.py https://huggingface.co/JullMol/POSEIDON/resolve/main/Phase_0/predict.py
527 Bytes
| 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)) | |