24 lines
387 B
Python
24 lines
387 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import sys
|
||
|
|
||
|
from analyzer import vectorizer
|
||
|
import torch
|
||
|
|
||
|
w = torch.load('model.bin')
|
||
|
|
||
|
|
||
|
def fun(w, x):
|
||
|
return x @ w
|
||
|
|
||
|
|
||
|
for line in sys.stdin:
|
||
|
line = line.strip('\n')
|
||
|
content = line
|
||
|
|
||
|
x = (torch.from_numpy(vectorizer.fit_transform([content]).toarray()))[0]
|
||
|
|
||
|
y_hat = fun(w, x)
|
||
|
|
||
|
print(max(1814.0, min(2013.999, y_hat.item() * 100.0 + 1913.0)))
|