Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to print variable present in python with the help of html?

I’ve written some code for deep learning text summarization, and I’m trying to render the template using the Flask library. I’m unable to see the results. The python code can be found below.

    text = ' '.join([summ['summary_text'] for summ in res])
    print(text)
return render_template('result.html', prediction=text)

I’m trying to print the prediction variable which is present in the above code. Below is the html code

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
</head>
<body>

    <header>
        <div class="container">
        <div id="brandname">
            Deep Learning App
        </div>
        <h2>Summarized text</h2>
        
    </div>
    </header>
    <p style="color:blue;font-size:20;text-align: center;"><b>Result for Text</b></p>
    <div class="results">


    
    <p><strong>{prediction}</strong></p>

    </div>

</body>
</html>

Below is output image

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

Can anyone help me how to display text present in prediction variable on web page?

>Solution :

You need double curly braces

<p><strong>{{ prediction }}</strong></p>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading