def preditc(): inc_visit_num() # redis增加访问次数 parseImage(request.get_data()) img = img_to_array(load_img('output.png', target_size=(28, 28), color_mode="grayscale")) / 255. img = np.expand_dims(img, axis=0) code = model.predict_classes(img)[0] response = get_visit_info(int(code)) print(response) return jsonify(response)
from redis_util import get_today, get_visit_num_all, get_visit_num_today, inc_visit_num if __name__ == '__main__': inc_visit_num() print(get_visit_num_all()) print(get_visit_num_today()) print(get_today())
def index(): inc_visit_num() response = get_visit_info() return render_template("index.html", **response)
def index(): inc_visit_num() response = get_visit_info() return render_template("index2.html", **response) # 如果没有使用 redis 统计访问次数功能,请使用index.html