I am using Flask for my web application and I am using Machine learning models for pattern prediction. Multiple images can be inputed by the user and based on those images there will be a dynamic table that will be provided to the user as a Result analysis.
The issue is suppose a user enters 3 images, only 1 table is visible instead of 3 different tables for 3 different images.
I am new to Flask and I am not sure what am I doing wrong. There are no Error messages in the console.
app.py (POST Request)
@app.route('/', methods=['POST'])
def upload_image():
    if request.method == 'POST':
        # checks whether or not the post request has the file part
        if 'files' not in request.files:
            flash('No file part')
            return redirect(request.url)
        file = request.files['files']
        if file.filename == '':
            flash('No file selected for uploading')
            return redirect(request.url)
        if file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            file.save(os.path.join(os.getcwd() +
                                   UPLOAD_INPUT_IMAGES_FOLDER, file.filename))
            flash('File successfully uploaded')
            extracted_text = ocr_processing(file)
            print(extracted_text)
            match = extracted_text.lower()
            dark_pattern_file = "/Users/ri/Desktop/DPL/DP.csv"
            df = pd.read_csv(dark_pattern_file)
            for row in df.Pattern_String:
                result = ratio(row, match)
                print(result)
                if result >= 10:
                    loaded_vec = CountVectorizer(
                        vocabulary=pickle.load(open("model/tfidf_vector.pkl", "rb")))
                    loaded_tfidf = pickle.load(open("model/tfidf_transformer.pkl", "rb"))
                    model_pattern_type = pickle.load(
                        open("model/clf_svm_Pattern_Category.pkl", "rb"))
                    model_pattern_category = pickle.load(
                        open("model/clf_svm_Pattern_Type.pkl", "rb"))
                    match = [match]
                    X_new_counts = loaded_vec.transform(
                        match)
                    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]
                    return render_template('uploads/results.html',
                                           msg='Processed successfully!',
                                           match=match,
                                           your_predicted_pattern_category=your_predicted_pattern_category,
                                           your_predicted_pattern_type=your_predicted_pattern_type,
                                           img_src=UPLOAD_INPUT_IMAGES_FOLDER + file.filename)
                else:
                    return render_template('uploads/results.html',
                                           msg='Processed successfully!',
                                           match=match,
                                           img_src=UPLOAD_INPUT_IMAGES_FOLDER + file.filename)
    else:
        flash('Allowed file types are txt, pdf, png, jpg, jpeg, gif')
        return redirect(request.url)
results.html (where the table is)
<table>
        <tbody>
        <tr>
            <th class="table-info">IMAGE PROVIDED</th>
            {% if img_src %}
            <td><img src="{{ img_src }}" alt="user-image" class="uploaded-image"></td>
            {% endif %}
        </tr>
        <tr>
           //Many other such rows
        </tr>
    
        </tbody>
    </table>