File size: 726 Bytes
69928d6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | """Predict using the selected AS2 instantiation's input/output contract."""
import json
from pathlib import Path
import hydra
from omegaconf import DictConfig
from softasp.configuration import config_directory
from softasp.instantiations.runtime import predict
@hydra.main(version_base="1.3", config_path=config_directory(), config_name="predict")
def main(cfg: DictConfig) -> None:
result = predict(cfg)
destination = Path(cfg.output)
destination.parent.mkdir(parents=True, exist_ok=True)
with destination.open("x") as stream:
json.dump(result, stream, indent=2, allow_nan=False)
stream.write("\n")
print(f"Predictions saved to {destination}")
if __name__ == "__main__":
main()
|