Example #1
0
    def test_similar(self):
        ctx = app.test_request_context()
        ctx.push()

        from engines import content_engine

        #content_engine.train('sample-data.csv')
        content_engine.train('/home/ubuntu/teamHTTP/serverPHP/engine/tfidf-item/iroya_data.csv')
Example #2
0
    def test_similar(self):
        ctx = app.test_request_context()
        ctx.push()

        from engines import content_engine

        #content_engine.train('sample-data.csv')
        content_engine.train('result.csv')
        '''
Example #3
0
def train():
    from engines import content_engine
    print "data:"
    print request.args
    print "end."

    data_url = request.data.get('data-url', None)
    print "a"
    content_engine.train(data_url)
    return {"message": "Success!", "success": 1}
Example #4
0
    def test_similar(self):
        ctx = app.test_request_context()
        ctx.push()

        from engines import content_engine

        content_engine.train('sample-data.csv')

        data = {'item': 1, 'num': 10}
        headers = [('Content-Type', 'application/json'), ('X-API-TOKEN', current_app.config['API_TOKEN'])]
        json_data = json.dumps(data)
        json_data_length = len(json_data)
        headers.append(('Content-Length', str(json_data_length)))

        response = app.test_client().post('/predict', headers=headers, data=json_data)
        response = json.loads(response.data)
        self.assertEqual(len(response), 10)
        self.assertEqual(response[0][0], "19")  # Boxers are like boxers.
Example #5
0
"""
Created on Mon Jan 16 01:30:40 2017

@author: mayank singh

sample-data is collection of offer ids and their descriptions(Harvested from OfferMaster.csv)
on which TF-IDF is run and their cosine similarities calculated and stored in redis.

sample-data length has been reduced considerabaly in order to compensate for low RAM




"""

from engines import content_engine
content_engine.train('sample-data.csv')
Example #6
0
def train():
    from engines import content_engine

    data_url = request.data.get("data-url", None)
    content_engine.train(data_url)
    return {"message": "Success!", "success": 1}
Example #7
0
def train():
    from engines import content_engine
    data_url = request.data.get('data-url', None)
    content_engine.train(data_url)
    return {"message": "Success!", "success": 1}
Example #8
0
def train():
    from engines import content_engine
    #data_url = request.get_data('data-url', None)
    content_engine.train("id_desc_price.xlsx")
    return "\n\nSuccess: Model trained\n\n"
Example #9
0
def train():
    from engines import content_engine
    filename = request.data.get('filename', None)
    content_engine.train(filename)
    return {"message": "Success", "success": 1}