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