sonIA / utils.py
Davide Fiocco
Fix age to update over time
34129b5
raw
history blame
446 Bytes
import datetime
import json
AGE = 1952
def get_answer(input, context, engine):
answer = engine({"question": input, "context": context})
return answer["answer"]
def get_context():
now = datetime.datetime.now()
with open("context.json") as f:
context = (
json.load(f)["info"]
.replace("[YEAR]", str(now.year))
.replace("[AGE]", str(now.year - AGE))
)
return context