Open joeyklee opened 5 years ago
It's still not working.
How should I get started contributing to such issues? :/
How should I get started contributing to such issues? :/
Here is the guide! :) https://github.com/ml5js/ml5-library/blob/development/CONTRIBUTING.md
FYI: For non-documented reason and only when loading p5.js, ml5.pix2pix without callback argument give back an object with two props ->
So for the example with promise to work, you'll have to call pix2pix like that:
ml5.pix2pix('models/edges2pikachu.pict').ready
.then(model => {
// ... your code here
})
FYI: For non-documented reason and only when loading p5.js, ml5.pix2pix without callback argument give back an object with two props ->
The object that you are looking at here is the pix2pix class instance. You'll see the methods if you expand the prototype:
only when loading p5.js
Thank you! You've uncovered some extremely weird behavior. I was looking at the pix2pix source code and it definitely returns a promise when there is no callback. I can confirm that calling ml5.pix2pix('models/edges2pikachu.pict')
works as intended (returns a promise) when there is no p5. Somehow p5 causes it to return the instance directly.
This must have something to do with the way that we are registering the functions with p5 in order to support preloading when they are called inside preload()
. That is not something that is specific to pix2pix, so I checked out some other models. It turns out that this is a problem everywhere!
https://github.com/ml5js/ml5-library/blob/c088cb89af201b7891289559bf8257671281cae1/src/index.js#L75 https://github.com/ml5js/ml5-library/blob/main/src/utils/p5PreloadHelper.js
→ Description 📝
The pix2pix promise example - https://github.com/ml5js/ml5-examples/tree/release/p5js/Pix2Pix/Pix2Pix_promise - breaks on load.
→ Screenshots 🖼
→ Helpful Information 🦄
A list of relevant information for this issue. This will help people navigate the project and offer some clues of where to start. Depending on the nature of this issue, important and helpful information might include:
development