I'm using python with eel to communicate with a local website as frontend. My code should display an image on a web page while in the middle of a long python function. The image only appears after the python function is executed, even though <img>
is present in the HTML at the correct time.
Here's my Javascript code:
eel.expose(set_image);
function set_image() {
document.getElementById("zoom-animate").innerHTML = '<img src="temp.png">';
}
function generate() {
let source = document.getElementById("source").value;
let keyword = document.getElementById("keyword").value;
eel.generate(source, keyword);
}
And my Python code:
@eel.expose
def generate(source, keyword):
# code that takes a long time to execute 1
eel.set_image()
# code that takes a long time to execute 2