AttributeError: 'list' object has no attribute 'lower' while trying to predict patterns

I am creating a web app using Flask where first I extract text from image and then use SVM to detect the type and category of the pattern. I am able to upload the images but then for the results it gives a 500 error. I want to be able to display the pattern type and category (using the trained pickle files) instead of displaying the OCR text

The reason for "POST /upload HTTP/1.1" 500 - is: AttributeError: 'list' object has no attribute 'lower'

@app.route('/upload', methods=['GET', 'POST'])
def upload_page():
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            return render_template('upload.html', msg='No file selected')
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            return render_template('upload.html', msg='No file selected')

        if file and allowed_file(file.filename):
   + UPLOAD_FOLDER, file.filename))

            # call the OCR function on it
            extracted_text = ocr_core(file)
            print (extracted_text)
            #loading pickle files 
            loaded_vec = CountVectorizer(vocabulary=pickle.load(open("./tfidf_vector.pkl", "rb")))
            loaded_tfidf = pickle.load(open("./tfidf_transformer.pkl","rb"))
            model_pattern_type = pickle.load(open("./clf_svm_Pattern_Category.pkl","rb"))
            model_pattern_category = pickle.load(open("./clf_svm_Pattern_Type.pkl","rb"))
            X_new_counts = loaded_vec.transform(
            X_new_tfidf = loaded_tfidf.transform(X_new_counts)

            predicted_pattern_type = model_pattern_type.predict(X_new_tfidf)
            your_predicted_pattern_type = predicted_pattern_type[0]

            predicted_pattern_category = model_pattern_category.predict(X_new_tfidf)
            your_predicted_pattern_category = predicted_pattern_category[0]
            # extract the text and display it
            return render_template('upload.html',
                                   msg='Successfully processed',
                                   img_src=UPLOAD_FOLDER + file.filename)
    elif request.method == 'GET':
        return render_template('upload.html')

if __name__ == '__main__':