def post(self): input_string = request.get_data().decode('UTF-8') my_extractor = extractor() my_extractor.from_string(input_string) print ("9") my_responser = responser() print ("9") obj1, obj2, predicates = my_extractor.get_params() print ("9") print ("len(obj1), len(obj2)", len(obj1), len(obj2)) print ("obj1, obj2, predicates", obj1, obj2, predicates) response = make_response(jsonify(first_object = obj1, second_object = obj2, preds = predicates)) return response
#device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") #LM_CAM = load_cam_model(device) #Cam = diviner(tp = 'cam', model = LM_CAM, device = device) #print ("loaded cam") device = torch.device("cuda:3" if torch.cuda.is_available() else "cpu") LM_SMALL = load_small_model(device) GPT2Small = diviner(tp='small', model=LM_SMALL, device=device) #GPT2Small_vs = diviner(tp = 'small_vs', model = LM_SMALL, device = device) #GPT2Small_vs_str = diviner(tp = 'small_vs_str', model = LM_SMALL, device = device) print("loaded gpt2") Templ = diviner(tp='templates', model='', device=device) my_extractor = extractor(my_device=3) print("loaded extractor") def main(): df = pd.DataFrame( columns=['Object 1', 'Object 2', 'Question', 'Best Answer', 'Answers']) with open('yahoo_answers_positive_questions.csv', 'r') as file: reader = csv.reader(file) for ind, row in enumerate(reader): d = { 'Object 1': row[0], 'Object 2': row[1], 'Question': row[2], 'Best Answer': row[3],