aitech-eks-pub/wyk/pytorch_regression/linear3-infer.py
2021-05-19 13:21:13 +02:00

21 lines
373 B
Python
Executable File

#!/usr/bin/env python3
import sys
from analyzer import midpoint, vectorize_text
import torch
model = torch.load('model.bin')
for line in sys.stdin:
line = line.strip('\n')
content = line
x = vectorize_text(content)
y_hat = model(x)
# na wyjściu musimy mieć z powrotem rok
print(max(1814.0, min(2013.999, y_hat.item() * 100.0 + midpoint)))