I have flask web app that user can upload image and display histogram i save my histogram image in static folder and delete it when user try to up new image
@app.route('/upload', methods=['POST'])
def upload():
file = request.files['file']
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
os.remove('./static/h_hist.png')
hsv_hist.histogram(filename)
return render_template("result.html", filename=filename)
histogram of new image have been save into static folder if user upload
but when i display it on my page the histogram image don't change to histogram of new image it is still the old one
result.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image Processing Result</title>
</head>
<body>
<div class="container">
<img src="{{ url_for('static', filename=filename) }}">
<h2>HSV Histogram</h2> <hr>
<img src="{{ url_for('static', filename='h_hist.png') }}">
</div>
</body>
</html>