@app.post('/training')
async def training(request: Request):
    votes = request.json['votes']
    config = read_config()
    do_retrain = request.json.get('retrain', False)
    inserted_user = (await request['accessor'].batch_register_users({str(vote[0]) for vote in votes}))
    inserted = (await request['accessor'].insert_votes(((str(vote[0]), str(vote[1]), (1 if (float(vote[2]) > config['positive_cutoff']) else (- 1))) for vote in votes)))
    if do_retrain:
        ensure_future(retrain(app, app.loop))
    return json({'inserted_users': inserted_user, 'inserted_votes': inserted})
@app.post('/training')
async def training(request: Request):
    votes = request.json['votes']
    config = read_config()
    do_retrain = request.json.get('retrain', False)
    inserted_user = (await request['accessor'].batch_register_users({str(vote[0]) for vote in votes}))
    inserted = (await request['accessor'].insert_votes(((str(vote[0]), str(vote[1]), (1 if (float(vote[2]) > config['positive_cutoff']) else (- 1))) for vote in votes)))
    if do_retrain:
        ensure_future(retrain(app, app.loop))
    return json({'inserted_users': inserted_user, 'inserted_votes': inserted})