Exemplo n.º 1
0
def by_name_group():
    data = to_Data()
    sname = data['name']
    group = data['group']
    page = data['page']
    if sname and group and page:
        info = get_Info(sname=sname, group=group)
        list = to_List(info, page)
        data = to_Json(list)
        return data
    return ("0")
Exemplo n.º 2
0
def clasiify_Image():
    print('开始识别!')
    data = request.files['image']
    image = data.read()
    result = imageclassify(image)
    id = -1
    for i in range(len(staticFood)):
        m = staticFood[i]['name']
        if (m == result):
            id = i
            print('食材id:', i)
            break
    data = to_Json(id)
    return data
Exemplo n.º 3
0
def get_meal():
    data = to_Data()
    meal = Meal
    u = data['user']
    print(u)
    i = 0
    food_score = cal_score(u)
    # 80种食物的评分,列表存储,有序
    print(food_score)
    for m in meal:
        if (i >= 80):
            m['score'] = get_Score(m, u, meal)
        else:
            m['score'] = food_score[i]
        i = i + 1
        if 'snack' in m['cata']:
            s = float(m['score']) / 2
            m['score'] = '%.1f' % s
    print(meal)
    data = to_Json(meal)
    return data