def run_classification(userid, jobid, image_path, socketid, token, source_type, result_path, db_token=None): #logger.write('P', 'Inside run_classification') message = 'Classification Complete' result = caffe_classify.caffe_classify(image_path) result = json.dumps(result) sendsMessageToRedis(userid, jobid, source_type, socketid, message, result_path=result_path, result_text=str(result), dropbox_token=db_token) r.publish('chat', json.dumps({'message': str(message), 'socketid': str(socketid), 'token': token, 'jobid': jobid}))
def run(self): try: result = caffe_classify(self.image_path) self.log_to_terminal(result) image, tags = result.popitem() web_result = {} web_result[self.result_path] = tags self.r.publish('chat',json.dumps({'web_result': json.dumps(web_result), 'socketid': str(self.socketid)})) except Exception as e: self.log_to_terminal(str(traceback.format_exc()))
def run(self): try: result = caffe_classify(self.image_path) self.log_to_terminal(result) image, tags = result.popitem() web_result = {} web_result[self.result_path] = tags self.r.publish( 'chat', json.dumps({ 'web_result': json.dumps(web_result), 'socketid': str(self.socketid) })) except Exception as e: self.log_to_terminal(str(traceback.format_exc()))