title: Classify Multiple Documents and store them in different folders Via Flask (python)
body: <p>I want to do is I want my web app to take multiple documents as input and classify them using my model and store those classified documents into different folders.</p>
  
  <p>I have developed a model which classifies documents. Model is ready and have accuracy of about 0.96 f-score. I want to implement it in flask. I already implemented on text input which shows accurate results.</p>
  
  <pre><code>((#LIBRARIES
  app = Flask(__name__)
  
  app.config.from_object(__name__) # load config from th
  
  app.config['UPLOAD_FOLDER'] = 'CV_upload/'
  app.config['ALLOWED_EXTENSIONS'] = set(['txt', 'pdf', 'png', 'jpg', 
      'jpeg', 'gif'])
  
  # Route for handling the login page logic
  @app.route('/login', methods=['GET', 'POST'])
  def login():
      error = None
      if request.method == 'POST':
          if request.form['username'] != 'admin' or 
      request.form['password'] != 'admin':
              error = 'Invalid Credentials. Please try again.'
          else:
              return redirect(url_for('home'))
      return render_template('index.html', error=error)
  
  @app.route('/logout')
  def logout():
      session.pop('logged_in', None)
      flash('You were logged out')
      return redirect(url_for('home'))
  
  
  @app.route('/home')
  def home():
      return render_template('home.html')
  
  @app.route('/predict',methods=['POST'])
  def predict():
      &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;#MY_NAIVE_BAYES MODEL 
     HERE&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
  
  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;THis is where i take input text but i want this to 
     change as input multiple pdf files and then classify them&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
                  if request.method == 'POST':
              message = request.form['message']
              data = [message]
              vect = vectorizer.transform(data).toarray()
              my_prediction = model.predict(vect)
              return render_template('result.html',prediction = my_prediction)
  
  
  
  if __name__ == '__main__':
      app.run(debug=True , threaded=True) 
  ))
  </code></pre>
  
  <p>I want to do is I want my web app to take multiple documents as input and classify them using my model and store those classified documents into different folders. When placed a query it will generate the result.</p>