title: Serve Deep learning Model with Celery or RESTful API?
body: <p>I am developing a web application which uses <strong>celery</strong> for task distribution and management. Web application also uses machine learning and deep learning algorithms to do predictions. These predictive models are deployed on separate server as separate application and their predictive functions are integrated with celery as individual <strong>task</strong>. </p>
  
  <p>For example, X (user) wants to know forecast of stock price and submits query to web application. Web application will initiate celery tasks with X's query payload. This Celery tasks after performing certain operations submits tasks to other server where machine learning / deep learning 's celery is working and start waiting for other server tasks to be completed and response to be received. </p>
  
  <p>This increased our performance to <strong>10 folds</strong> as compare to when we deployed <strong>RESTful</strong> endpoints for machine learning predictive models using Flask. For deep learning, we need to move to <strong>Tensorflow</strong> and integrate it with celery. After thorough research, it was concluded to use <strong>Tensorflow Serving</strong> and call predictive functions inside celery tasks on machine learning server. </p>
  
  <p>Other approach, was to deploy TensorFlow models as separate end points using <strong>Sanic</strong> and rather than web application's celery submitting tasks directly to other server celery, now it will directly execute and call <strong>RESTful API</strong> Endpoint which will be asynchronous as well.</p>
  
  <p>What do you suggest, what would work best for us in this scenario? What benefit can celery provide over RESTful API or vice versa?</p>