示例#1
0
async def word2vec(request):
    word = request.args['word'][0]

    if word in model:
        return json({'data': model[word]})

    return response.json({'message': '404 Not Found'}, status=404)
示例#2
0
async def words2vec(request):
    if 'words' not in request.json:
        return response.json(
            {'message': 'Please provide array of words as body'}, status=422)

    words = request.json['words']

    res = {x: model[x] if x in model else None for x in words}

    return json(res)
示例#3
0
async def test(request):
    return json({"hello": "world"})
示例#4
0
async def test(request):
    return json({"response": "i'm alive"})