I am new to Django framework. I am building a website that take an image from user, then process the image and return to a numpy array (processed image). I want to show the numpy array as image. How can I do that? Thank you for reading and helps?
index.html
<form name="image" method = "post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Upload</button>
</form>
Index view
def index(request):
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
model = MyDeepLearningModel.get_instance()
file_name = request.FILES['file']
processed_image = model.run_png(file_name) #processed_image is an numpy array
#how to show the processed_image in index.html?
return render(request, 'lowlighten/index.html')
else:
form = UploadFileForm()
return render(request, 'lowlighten/index.html', {'form': form})