title: Flask - Bad Request The browser sent a request that this server could not understand
body: <p>I am trying to make the prediction of the parser model, pre trained spacy model is used, i am using flask as an api and html as front end. But it is throwing an error of bad request.</p>
  <pre><code>@app.route('/index')
  def index():
      return flask.render_template('index.html')
  
  
  
  @app.route('/index', methods=['GET', 'POST'])
  
  
  def predict():
      if request.method == 'POST':
          image_file = request.files[&quot;file_image&quot;]
   
  nlp_model = spacy.load(&quot;nlp_model&quot;)
  
  img2 = cv2.imread(image_file)
  img_rgb = cv2.cvtColor(img2, cv2.COLOR_BGR2RGB)
  pytesseract.pytesseract.tesseract_cmd = r'C:\Tesseract- 
  OCR\tesseract.exe'
  out_below_1 = pytesseract.image_to_string(img_rgb,  
  config=pytesseract.pytesseract.tesseract_cmd)
  tx = &quot; &quot;.join(out_below_1.split('\n')) 
  
  doc = nlp_model(tx)
  s = []
  
  for ent in doc.ents:
      s.append(ent)
  
  return  s
  
  if __name__ == '__main__':
      app.run()
  </code></pre>