Troubleshooting Data Display Issues in a Flask Web Application

this code should process the user text or file it used to work successfully till I had an error and during the error I reloaded the web and it started to display this message (No recommendations to display) even though I fixed the error it still the same whenever I reloaded the web and it no more displays the boxes only the message no matter what

here is the fe code ,, I get the only message on terminal saying (INFO:root:GET request processed)

app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        text_data = request.form.get('text')
        file = request.files.get('file')
        response_data = {}
        error_message = None
        
        if text_data:
            logging.info('Processing text data')
            response_json = send_to_other_app({'text': text_data}, 'create_cv')
            if response_json is not None:
                recommendations = response_json['recommendations']
                recommendations_newlines = recommendations.replace("['", " ").replace("',", " ").replace("']", " ").replace("'", " ")
                recommendations_newlines = recommendations.replace("\n", "n")
                response_json['recommendations'] = recommendations_newlines
                response_data['text_response'] = response_json
                logging.info(f'response_json_0  : {response_json}')
            else:
                error_message = 'Failed to process text data due to an external service error.'
        
        elif file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            save_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
            file.save(save_path)
            logging.info(f'File uploaded: {filename} to path: {save_path}')
            response_json = send_to_other_app({'file_path': save_path}, 'recommend')
            if response_json is not None:
                response_data['file_response'] = response_json
                logging.info(f'response_json_1 {response_json}')
            else:
                logging.info(f'response_json_2 {response_json}')
                error_message = 'Failed to process file due to an external service error.'
        
        if response_data:
            logging.info(f"Response data available: {response_data}")
            return render_template('recommendations.html', response=response_data)
        
        if not response_data and not error_message:
            logging.info("No response data available.")
            error_message = 'No text data or valid file provided for processing.'
        
        logging.error(error_message)
        return jsonify({'error': error_message}), 400

    # Handle GET request
    logging.info('GET request processed')
    return render_template('index.html')

here is the html code

    </style>
</head>
<body>
    <div class="container">
        {% if response %}
            {% if response.text_response %}
                <!-- CV Generated Box -->
                <div class="box">
                    <h2>CV Generated</h2>
                    <div class="content-box">
                        <pre>{{ response.text_response.created_cv }}</pre>
                    </div>
                </div>
        
                <!-- Recommendations Box -->
                <div class="box">
                    <h2>Recommendation</h2>
                    <div class="content-box">
                        <!-- Convert escaped newlines to HTML line breaks -->
                        <pre>{{ response.text_response.recommendations}}</pre>



                    </div>
                </div>
            {% endif %}
            {% if response.file_response %}
                <!-- File Response Box -->
                <div class="box">
                    <h2>Recommendation</h2>
                    <div class="content-box">
                        <pre>{{ response.file_response.recommendations }}</pre>
                    </div>
                </div>
            {% endif %}
        {% else %}
            <div class="no-recommendations">
                <p>No recommendations to display at the moment.</p>
            </div>
        {% endif %}
    </div>
</body>
</html>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật