def get_users_from_database(data): try: users = get_users(db, data['user']) new_users = filter_dm(users, data['user']) response = {'users': new_users} emit('total users', response) except Exception as e: print(e)
def post(self): user = self.get_argument('user', None) password = self.get_argument('password', None) # retrieve the user list from the database users = data.get_users() # if there's a match, set cookie then redirect if user in users and users[user] == password: self.set_secure_cookie("user", user) print "User " + user + " logged in." self.redirect('/' + user + '/Fenng/1') # if there's no match, send 404 else: error = dict() error['message'] = "Wrong user name or password." print "Invalid user " + user + " attempted to log in." return self.send_error(404, **error)
def get_user_sessions(limit=None, filename="", directory="", version=Version.UNDIAG_2014): for users in get_users(limit=limit, filename=filename, directory=directory): users_with_sessions = extract_sessions(users, version=version) yield users_with_sessions
def users(request): return data.get_users()
from flask import Flask, render_template, jsonify from gensim.models import Word2Vec from gensim.models import KeyedVectors import pandas as pd import numpy as np from flask import request # Это просто нужно, для того, чтобы можно было отдавать данные from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) from data import get_users users = get_users() #from sklearn.cluster import KMeans # Импортируем базу данных всех товаров с указанием Наименований, Категорий и пр. bdd_rms = pd.read_excel('library/BDD.xlsx', names=[ 'product', 'department', 'model_adeo', 'model_name', 'date_created', 'product_name', 'is_stm' ]) ################# Импортируем обученные модели #################### # Стандартная модель, обученная на артикулах model_products = Word2Vec.load('models/w2v_64m_sg0_i220_window9_size160')