Exemplo n.º 1
0
def predict(offer):
    from engines import content_engine
    num_predictions = 5
    offer_list=content_engine.predict(offer, num_predictions)
    print("Similar offers recommended for you:")
	for s in offer_list:
		print(*s)
Exemplo n.º 2
0
def predict():
    from engines import content_engine
    item = request.data.get('item')
    num_predictions = request.data.get('num', 10)
    if not item:
        return []
    return content_engine.predict(str(item), num_predictions)
def predict():
    from engines import content_engine
    item = request.data.get('item')
    num_predictions = request.data.get('num', 10)
    if not item:
        return []
    return content_engine.predict(str(item), num_predictions)
Exemplo n.º 4
0
def predict():
    from engines import content_engine
    item = request.get_data('item')
    num_predictions = 10
    if not item:
        return []
    return content_engine.predict(str(item), num_predictions,
                                  "id_desc_price.xlsx")
Exemplo n.º 5
0
def predict(offer):
    from engines import content_engine
    num_predictions = 5
    print("Similar offers recommended for you:")
    similar_offer_list = content_engine.predict(offer, num_predictions)
    # prints similar offers along with their similarity score
    for s in similar_offer_list:
        print(int(s[0]), s[1])
Exemplo n.º 6
0
def predict():
    from engines import content_engine
    item = request.data.get('item')
    realID = item
    # if item == -1, means prediction for the last row.
    if item == '-1':
        with open('backup.csv') as source:
            reader = csv.DictReader(source.read().splitlines())
            realID = str(len(list(reader)) - 1)

    num_predictions = request.data.get('num', 10)
    data_url = request.data.get('data-url', None)
    if not realID:
        return []

    # For now, only returns a nested list of the top num of post and their scores, need more detailed loggin info!
    return content_engine.predict(str(realID), int(num_predictions), data_url)
Exemplo n.º 7
0
def predict():
    from engines import content_engine
    item = request.data.get('item')
    realID = item
    # if item == -1, means prediction for the last row.
    if item == '-1':
        with open('backup.csv') as source:
            reader = csv.DictReader(source.read().splitlines())
            realID = str(len(list(reader)) - 1)

    num_predictions = request.data.get('num', 10)
    data_url = request.data.get('data-url', None)
    if not realID:
        return []
    
    # For now, only returns a nested list of the top num of post and their scores, need more detailed loggin info!
    return content_engine.predict(str(realID), int(num_predictions), data_url)