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')
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') '''
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}
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.
""" 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')
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}
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}
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"
def train(): from engines import content_engine filename = request.data.get('filename', None) content_engine.train(filename) return {"message": "Success", "success": 1}