FIX - ADD BACKGROUND IMAGE
code-boxx opened this issue · 6 comments
main.py
# bg_input = gr.UploadButton(label="Add Background Image", file_types=["image"], elem_id="openpose_bg_button")
bg_input = gr.Button(value="Add Background Image")
#bg_input.upload(None, [bg_input], [width, height], _js="addBackground")
bg_input.click(None, [], None, _js="addBackground")
main.js
async function addBackground () {
const input = document.createElement("input");
input.type = "file"
input.accept = "image/*"
input.onchange = e => {
const file = e.target.files[0];
var fileReader = new FileReader();
fileReader.onload = async function () {
var url = this.result;
openpose_editor_canvas.setBackgroundImage(url, openpose_editor_canvas.renderAll.bind(openpose_editor_canvas), {
opacity: 0.5
});
const img = new Image();
await (img.src = url);
resizeCanvas(img.width, img.height);
};
fileReader.readAsDataURL(file);
};
input.click();
}
Quick and dirty fix. Time to switch UploadButton
to Button
...
I have made the indicated modification in both files, now the loading of background images works, but the rest of the options do not, when I try to load a json model it does nothing and when I want it to recognize the pose from an image it is as if I placed it background, but the canvas cannot be moved
i updated to latest version and cant to add background image anyway
The version "db07b9c6" continues to appear after updating.
I have also modified the code as indicated and the same problems continue to appear, at least with version 1.6
The version "db07b9c6" continues to appear after updating.
I have also modified the code as indicated and the same problems continue to appear, at least with version 1.6
Please show me the screenshot of the browser's dev console.