Code Monkey home page Code Monkey logo

content-engine's People

Contributors

annp89 avatar anton-shutik avatar chrisclark avatar dawny33 avatar noazark avatar wei-xia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

content-engine's Issues

Flask-API needed

Hi, I am trying this great app. But when I followed the guide, I got an error:

→ python2 web.py
Traceback (most recent call last):
  File "web.py", line 1, in <module>
    from flask.ext.api import FlaskAPI
  File "/Users/chet/anaconda/envs/crec/lib/python2.7/site-packages/flask/exthook.py", line 87, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named flask.ext.api

I find a solution from http://www.flaskapi.org/. It seems it depends on Flask-API which only can be installed through pip.

pip install Flask-API

Then, I try again.

→ python web.py
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Restarting with stat
Debugger is active!
Debugger pin code: 872-190-294

But the link shows:

Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

So, is it right way to build the web?
Thank you

Object of type 'bytes' is not JSON serializable when I try to predict

Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2309, in call
return self.wsgi_app(environ, start_response)
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1831, in finalize_request
response = self.make_response(rv)
File "/anaconda3/lib/python3.6/site-packages/flask_api/app.py", line 60, in make_response
rv = self.response_class(rv, headers=headers, status=status)
File "/anaconda3/lib/python3.6/site-packages/flask_api/response.py", line 20, in init
content = renderer.render(content, media_type, **options)
File "/anaconda3/lib/python3.6/site-packages/flask_api/renderers.py", line 61, in render
return json.dumps(data, cls=JSONEncoder, ensure_ascii=False, indent=indent)
File "/anaconda3/lib/python3.6/json/init.py", line 238, in dumps
**kw).encode(obj)
File "/anaconda3/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/anaconda3/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/anaconda3/lib/python3.6/site-packages/flask/json/init.py", line 81, in default
return _json.JSONEncoder.default(self, o)
File "/anaconda3/lib/python3.6/json/encoder.py", line 180, in default
o.class.name)
TypeError: Object of type 'bytes' is not JSON serializable

Url error

I'm getting forbidden error when I use the url for train and predict.
image

Error of redis zadd()

Hi,
Thanks for sharing such useful content based recommendation engine.

When testing your example i get below error

File "sklearn_tfidf.py", line 74, in _train self._r.zadd(self.SIMKEY % row['id'], *flattened) TypeError: zadd() takes from 3 to 7 positional arguments but 198 were given

Can you please guide me what is going wrong ?
I have latest redis version installed and i am using python3

Error while running web.py

I have installed all dependencies from requirements.txt . When I run web.py, i am getting this error.

ImportError: No module named flask.ext.api

I have installed Flask-API package also. But not resolved.
What may be the solution

Connection Error while training

I get the following error

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>ConnectionError: Error 111 connecting to localhost:6379. Connection refused. // Werkzeug Debugger</title>
    <link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css"
        type="text/css">
    <!-- We need to make sure this has a favicon so that the debugger does
         not by accident trigger a request to /favicon.ico which might
         change the application state. -->
    <link rel="shortcut icon"
        href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
    <script src="?__debugger__=yes&amp;cmd=resource&amp;f=jquery.js"></script>
    <script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
    <script type="text/javascript">
      var TRACEBACK = 140719116431504,
          CONSOLE_MODE = false,
          EVALEX = true,
          EVALEX_TRUSTED = false,
          SECRET = "F0EW1BkY3lU19yHpPAZm";
    </script>
  </head>
  <body style="background-color: #fff">
    <div class="debugger">
<h1>redis.exceptions.ConnectionError</h1>
<div class="detail">
  <p class="errormsg">ConnectionError: Error 111 connecting to localhost:6379. Connection refused.</p>
</div>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
<div class="traceback">
  
  <ul><li><div class="frame" id="frame-140719112032336">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1836</em>,
      in <code class="function">__call__</code></h4>
  <div class="source"><pre class="line before"><span class="ws">                                </span>'Flask.blueprints instead'), stacklevel=2)</pre>
<pre class="line before"><span class="ws">        </span>return self.blueprints</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def __call__(self, environ, start_response):</pre>
<pre class="line before"><span class="ws">        </span>&quot;&quot;&quot;Shortcut for :attr:`wsgi_app`.&quot;&quot;&quot;</pre>
<pre class="line current"><span class="ws">        </span>return self.wsgi_app(environ, start_response)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def __repr__(self):</pre>
<pre class="line after"><span class="ws">        </span>return '&lt;%s %r&gt;' % (</pre>
<pre class="line after"><span class="ws">            </span>self.__class__.__name__,</pre>
<pre class="line after"><span class="ws">            </span>self.name,</pre></div>
</div>

<li><div class="frame" id="frame-140719112032848">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1820</em>,
      in <code class="function">wsgi_app</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span>try:</pre>
<pre class="line before"><span class="ws">            </span>try:</pre>
<pre class="line before"><span class="ws">                </span>response = self.full_dispatch_request()</pre>
<pre class="line before"><span class="ws">            </span>except Exception as e:</pre>
<pre class="line before"><span class="ws">                </span>error = e</pre>
<pre class="line current"><span class="ws">                </span>response = self.make_response(self.handle_exception(e))</pre>
<pre class="line after"><span class="ws">            </span>return response(environ, start_response)</pre>
<pre class="line after"><span class="ws">        </span>finally:</pre>
<pre class="line after"><span class="ws">            </span>if self.should_ignore_error(error):</pre>
<pre class="line after"><span class="ws">                </span>error = None</pre>
<pre class="line after"><span class="ws">            </span>ctx.auto_pop(error)</pre></div>
</div>

<li><div class="frame" id="frame-140719112032976">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1403</em>,
      in <code class="function">handle_exception</code></h4>
  <div class="source"><pre class="line before"><span class="ws">            </span># if we want to repropagate the exception, we can attempt to</pre>
<pre class="line before"><span class="ws">            </span># raise it with the whole traceback in case we can do that</pre>
<pre class="line before"><span class="ws">            </span># (the function was actually called from the except part)</pre>
<pre class="line before"><span class="ws">            </span># otherwise, we just raise the error again</pre>
<pre class="line before"><span class="ws">            </span>if exc_value is e:</pre>
<pre class="line current"><span class="ws">                </span>reraise(exc_type, exc_value, tb)</pre>
<pre class="line after"><span class="ws">            </span>else:</pre>
<pre class="line after"><span class="ws">                </span>raise e</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">        </span>self.log_exception((exc_type, exc_value, tb))</pre>
<pre class="line after"><span class="ws">        </span>if handler is None:</pre></div>
</div>

<li><div class="frame" id="frame-140719112033040">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1817</em>,
      in <code class="function">wsgi_app</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span>ctx = self.request_context(environ)</pre>
<pre class="line before"><span class="ws">        </span>ctx.push()</pre>
<pre class="line before"><span class="ws">        </span>error = None</pre>
<pre class="line before"><span class="ws">        </span>try:</pre>
<pre class="line before"><span class="ws">            </span>try:</pre>
<pre class="line current"><span class="ws">                </span>response = self.full_dispatch_request()</pre>
<pre class="line after"><span class="ws">            </span>except Exception as e:</pre>
<pre class="line after"><span class="ws">                </span>error = e</pre>
<pre class="line after"><span class="ws">                </span>response = self.make_response(self.handle_exception(e))</pre>
<pre class="line after"><span class="ws">            </span>return response(environ, start_response)</pre>
<pre class="line after"><span class="ws">        </span>finally:</pre></div>
</div>

<li><div class="frame" id="frame-140719112033104">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1477</em>,
      in <code class="function">full_dispatch_request</code></h4>
  <div class="source"><pre class="line before"><span class="ws">            </span>request_started.send(self)</pre>
<pre class="line before"><span class="ws">            </span>rv = self.preprocess_request()</pre>
<pre class="line before"><span class="ws">            </span>if rv is None:</pre>
<pre class="line before"><span class="ws">                </span>rv = self.dispatch_request()</pre>
<pre class="line before"><span class="ws">        </span>except Exception as e:</pre>
<pre class="line current"><span class="ws">            </span>rv = self.handle_user_exception(e)</pre>
<pre class="line after"><span class="ws">        </span>response = self.make_response(rv)</pre>
<pre class="line after"><span class="ws">        </span>response = self.process_response(response)</pre>
<pre class="line after"><span class="ws">        </span>request_finished.send(self, response=response)</pre>
<pre class="line after"><span class="ws">        </span>return response</pre>
<pre class="line after"><span class="ws"></span> </pre></div>
</div>

<li><div class="frame" id="frame-140719112033168">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask_api/app.py"</cite>,
      line <em class="line">95</em>,
      in <code class="function">handle_user_exception</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span>app_handlers = self.error_handler_spec[None].get(None, ())</pre>
<pre class="line before"><span class="ws">        </span>for typecheck, handler in chain(blueprint_handlers, app_handlers):</pre>
<pre class="line before"><span class="ws">            </span>if isinstance(e, typecheck):</pre>
<pre class="line before"><span class="ws">                </span>return handler(e)</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line current"><span class="ws">        </span>reraise(exc_type, exc_value, tb)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def handle_api_exception(self, exc):</pre>
<pre class="line after"><span class="ws">        </span>return APIResponse({'message': exc.detail}, status=exc.status_code)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def create_url_adapter(self, request):</pre></div>
</div>

<li><div class="frame" id="frame-140719112033232">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1475</em>,
      in <code class="function">full_dispatch_request</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span>self.try_trigger_before_first_request_functions()</pre>
<pre class="line before"><span class="ws">        </span>try:</pre>
<pre class="line before"><span class="ws">            </span>request_started.send(self)</pre>
<pre class="line before"><span class="ws">            </span>rv = self.preprocess_request()</pre>
<pre class="line before"><span class="ws">            </span>if rv is None:</pre>
<pre class="line current"><span class="ws">                </span>rv = self.dispatch_request()</pre>
<pre class="line after"><span class="ws">        </span>except Exception as e:</pre>
<pre class="line after"><span class="ws">            </span>rv = self.handle_user_exception(e)</pre>
<pre class="line after"><span class="ws">        </span>response = self.make_response(rv)</pre>
<pre class="line after"><span class="ws">        </span>response = self.process_response(response)</pre>
<pre class="line after"><span class="ws">        </span>request_finished.send(self, response=response)</pre></div>
</div>

<li><div class="frame" id="frame-140719112033296">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py"</cite>,
      line <em class="line">1461</em>,
      in <code class="function">dispatch_request</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span># request came with the OPTIONS method, reply automatically</pre>
<pre class="line before"><span class="ws">        </span>if getattr(rule, 'provide_automatic_options', False) \</pre>
<pre class="line before"><span class="ws">           </span>and req.method == 'OPTIONS':</pre>
<pre class="line before"><span class="ws">            </span>return self.make_default_options_response()</pre>
<pre class="line before"><span class="ws">        </span># otherwise dispatch to the handler for that endpoint</pre>
<pre class="line current"><span class="ws">        </span>return self.view_functions[rule.endpoint](**req.view_args)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def full_dispatch_request(self):</pre>
<pre class="line after"><span class="ws">        </span>&quot;&quot;&quot;Dispatches the request and on top of that performs request</pre>
<pre class="line after"><span class="ws">        </span>pre and postprocessing as well as HTTP exception catching and</pre>
<pre class="line after"><span class="ws">        </span>error handling.</pre></div>
</div>

<li><div class="frame" id="frame-140719112033360">
  <h4>File <cite class="filename">"/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/web.py"</cite>,
      line <em class="line">13</em>,
      in <code class="function">decorated_function</code></h4>
  <div class="source"><pre class="line before"><span class="ws"></span>def token_auth(f):</pre>
<pre class="line before"><span class="ws">    </span>@wraps(f)</pre>
<pre class="line before"><span class="ws">    </span>def decorated_function(*args, **kwargs):</pre>
<pre class="line before"><span class="ws">        </span>if request.headers.get('X-API-TOKEN', None) != current_app.config['API_TOKEN']:</pre>
<pre class="line before"><span class="ws">            </span>abort(403)</pre>
<pre class="line current"><span class="ws">        </span>return f(*args, **kwargs)</pre>
<pre class="line after"><span class="ws">    </span>return decorated_function</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span>@app.route('/predict', methods=['POST'])</pre>
<pre class="line after"><span class="ws"></span>@token_auth</pre>
<pre class="line after"><span class="ws"></span>def predict():</pre></div>
</div>

<li><div class="frame" id="frame-140719112032720">
  <h4>File <cite class="filename">"/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/web.py"</cite>,
      line <em class="line">32</em>,
      in <code class="function">train</code></h4>
  <div class="source"><pre class="line before"><span class="ws"></span>@app.route('/train')</pre>
<pre class="line before"><span class="ws"></span>@token_auth</pre>
<pre class="line before"><span class="ws"></span>def train():</pre>
<pre class="line before"><span class="ws">        </span>from engine import content_engine</pre>
<pre class="line before"><span class="ws">        </span>data_url = request.data.get('data-url', None)</pre>
<pre class="line current"><span class="ws">        </span>content_engine.train(data_url)</pre>
<pre class="line after"><span class="ws">        </span>return{&quot;message&quot;: &quot;Success!&quot;, &quot;success&quot;: 1}</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span>if __name__ == &quot;__main__&quot;:</pre>
<pre class="line after"><span class="ws">        </span>app.debug = True</pre>
<pre class="line after"><span class="ws">        </span>app.run()</pre></div>
</div>

<li><div class="frame" id="frame-140719112032912">
  <h4>File <cite class="filename">"/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/engine.py"</cite>,
      line <em class="line">23</em>,
      in <code class="function">train</code></h4>
  <div class="source"><pre class="line before"><span class="ws">                </span>start = time.time()</pre>
<pre class="line before"><span class="ws">                </span>ds = pd.read_csv(data_source)</pre>
<pre class="line before"><span class="ws">                </span>info(&quot;Training data ingested in %s seconds.&quot; %(time.time() - start))</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">                </span># flush stale training data from redis</pre>
<pre class="line current"><span class="ws">                </span>self._r.flushdb()</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">                </span>start = time.time()</pre>
<pre class="line after"><span class="ws">                </span>self._train(ds)</pre>
<pre class="line after"><span class="ws">                </span>info(&quot;Engine trained in %s seconds&quot; %(time.time() - start))</pre>
<pre class="line after"><span class="ws"></span> </pre></div>
</div>

<li><div class="frame" id="frame-140719112033488">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/client.py"</cite>,
      line <em class="line">644</em>,
      in <code class="function">flushdb</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span>&quot;Delete all keys in all databases on the current host&quot;</pre>
<pre class="line before"><span class="ws">        </span>return self.execute_command('FLUSHALL')</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def flushdb(self):</pre>
<pre class="line before"><span class="ws">        </span>&quot;Delete all keys in the current database&quot;</pre>
<pre class="line current"><span class="ws">        </span>return self.execute_command('FLUSHDB')</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def info(self, section=None):</pre>
<pre class="line after"><span class="ws">        </span>&quot;&quot;&quot;</pre>
<pre class="line after"><span class="ws">        </span>Returns a dictionary containing information about the Redis server</pre>
<pre class="line after"><span class="ws"></span> </pre></div>
</div>

<li><div class="frame" id="frame-140719112033616">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/client.py"</cite>,
      line <em class="line">570</em>,
      in <code class="function">execute_command</code></h4>
  <div class="source"><pre class="line before"><span class="ws">            </span>return self.parse_response(connection, command_name, **options)</pre>
<pre class="line before"><span class="ws">        </span>except (ConnectionError, TimeoutError) as e:</pre>
<pre class="line before"><span class="ws">            </span>connection.disconnect()</pre>
<pre class="line before"><span class="ws">            </span>if not connection.retry_on_timeout and isinstance(e, TimeoutError):</pre>
<pre class="line before"><span class="ws">                </span>raise</pre>
<pre class="line current"><span class="ws">            </span>connection.send_command(*args)</pre>
<pre class="line after"><span class="ws">            </span>return self.parse_response(connection, command_name, **options)</pre>
<pre class="line after"><span class="ws">        </span>finally:</pre>
<pre class="line after"><span class="ws">            </span>pool.release(connection)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def parse_response(self, connection, command_name, **options):</pre></div>
</div>

<li><div class="frame" id="frame-140719112033680">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py"</cite>,
      line <em class="line">556</em>,
      in <code class="function">send_command</code></h4>
  <div class="source"><pre class="line before"><span class="ws">            </span>self.disconnect()</pre>
<pre class="line before"><span class="ws">            </span>raise</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def send_command(self, *args):</pre>
<pre class="line before"><span class="ws">        </span>&quot;Pack and send a command to the Redis server&quot;</pre>
<pre class="line current"><span class="ws">        </span>self.send_packed_command(self.pack_command(*args))</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def can_read(self):</pre>
<pre class="line after"><span class="ws">        </span>&quot;Poll the socket to see if there's data that can be read.&quot;</pre>
<pre class="line after"><span class="ws">        </span>sock = self._sock</pre>
<pre class="line after"><span class="ws">        </span>if not sock:</pre></div>
</div>

<li><div class="frame" id="frame-140719112033744">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py"</cite>,
      line <em class="line">532</em>,
      in <code class="function">send_packed_command</code></h4>
  <div class="source"><pre class="line before"><span class="ws">        </span>self._sock = None</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def send_packed_command(self, command):</pre>
<pre class="line before"><span class="ws">        </span>&quot;Send an already packed command to the Redis server&quot;</pre>
<pre class="line before"><span class="ws">        </span>if not self._sock:</pre>
<pre class="line current"><span class="ws">            </span>self.connect()</pre>
<pre class="line after"><span class="ws">        </span>try:</pre>
<pre class="line after"><span class="ws">            </span>if isinstance(command, str):</pre>
<pre class="line after"><span class="ws">                </span>command = [command]</pre>
<pre class="line after"><span class="ws">            </span>for item in command:</pre>
<pre class="line after"><span class="ws">                </span>self._sock.sendall(item)</pre></div>
</div>

<li><div class="frame" id="frame-140719112033808">
  <h4>File <cite class="filename">"/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py"</cite>,
      line <em class="line">436</em>,
      in <code class="function">connect</code></h4>
  <div class="source"><pre class="line before"><span class="ws">            </span>return</pre>
<pre class="line before"><span class="ws">        </span>try:</pre>
<pre class="line before"><span class="ws">            </span>sock = self._connect()</pre>
<pre class="line before"><span class="ws">        </span>except socket.error:</pre>
<pre class="line before"><span class="ws">            </span>e = sys.exc_info()[1]</pre>
<pre class="line current"><span class="ws">            </span>raise ConnectionError(self._error_message(e))</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">        </span>self._sock = sock</pre>
<pre class="line after"><span class="ws">        </span>try:</pre>
<pre class="line after"><span class="ws">            </span>self.on_connect()</pre>
<pre class="line after"><span class="ws">        </span>except RedisError:</pre></div>
</div>
</ul>
  <blockquote>ConnectionError: Error 111 connecting to localhost:6379. Connection refused.</blockquote>
</div>

<div class="plain">
  <form action="/?__debugger__=yes&amp;cmd=paste" method="post">
    <p>
      <input type="hidden" name="language" value="pytb">
      This is the Copy/Paste friendly version of the traceback.  <span
      class="pastemessage">You can also paste this traceback into
      a <a href="https://gist.github.com/">gist</a>:
      <input type="submit" value="create paste"></span>
    </p>
    <textarea cols="50" rows="10" name="code" readonly>Traceback (most recent call last):
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask_api/app.py&quot;, line 95, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py&quot;, line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File &quot;/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/web.py&quot;, line 13, in decorated_function
    return f(*args, **kwargs)
  File &quot;/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/web.py&quot;, line 32, in train
    content_engine.train(data_url)
  File &quot;/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/engine.py&quot;, line 23, in train
    self._r.flushdb()
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/client.py&quot;, line 644, in flushdb
    return self.execute_command('FLUSHDB')
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/client.py&quot;, line 570, in execute_command
    connection.send_command(*args)
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py&quot;, line 556, in send_command
    self.send_packed_command(self.pack_command(*args))
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py&quot;, line 532, in send_packed_command
    self.connect()
  File &quot;/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py&quot;, line 436, in connect
    raise ConnectionError(self._error_message(e))
ConnectionError: Error 111 connecting to localhost:6379. Connection refused.</textarea>
  </form>
</div>
<div class="explanation">
  The debugger caught an exception in your WSGI application.  You can now
  look at the traceback which led to the error.  <span class="nojavascript">
  If you enable JavaScript you can also use additional features such as code
  execution (if the evalex feature is enabled), automatic pasting of the
  exceptions and much more.</span>
</div>
      <div class="footer">
        Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
        friendly Werkzeug powered traceback interpreter.
      </div>
    </div>

    <div class="pin-prompt">
      <div class="inner">
        <h3>Console Locked</h3>
        <p>
          The console is locked and needs to be unlocked by entering the PIN.
          You can find the PIN printed out on the standard output of your
          shell that runs the server.
        <form>
          <p>PIN:
            <input type=text name=pin size=14>
            <input type=submit name=btn value="Confirm Pin">
        </form>
      </div>
    </div>
  </body>
</html>

<!--

Traceback (most recent call last):
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask_api/app.py", line 95, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/web.py", line 13, in decorated_function
    return f(*args, **kwargs)
  File "/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/web.py", line 32, in train
    content_engine.train(data_url)
  File "/home/jarvis/My projects/Machine Learning/Parags assignment/Mark1_content_based_rec_engine/engine.py", line 23, in train
    self._r.flushdb()
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/client.py", line 644, in flushdb
    return self.execute_command('FLUSHDB')
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/client.py", line 570, in execute_command
    connection.send_command(*args)
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py", line 556, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py", line 532, in send_packed_command
    self.connect()
  File "/home/jarvis/anaconda3/envs/crec/lib/python2.7/site-packages/redis/connection.py", line 436, in connect
    raise ConnectionError(self._error_message(e))
ConnectionError: Error 111 connecting to localhost:6379. Connection refused.

when I try

 curl -X GET -H "X-API-TOKEN: FOOBAR1" -H "Content-Type: application/json; charset=utf-8" http://127.0.0.1:5000/train -d '{"data-url": "sample-data.csv"}'

Query regarding data and execution

Hey, I see that you've used elasticsearch. I want to know if you've sanitized the data properly to fit the JSON format. And is the project in an executable state ?

Issue with Setting-up content-engine

Hi Chris,
I'm newbie to recommender systems and I found your blog interesting and intuitive to follow. Therefore, I thought of trying it out as a first step.

But I am stuck in setting-up content engine on my Windows10 PC

Pls. help me ! Snapshot of the error message in creating new virtual environment is given below.

image

Thanks,
Bala

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.