ml5js/ml5-next-gen

Why the code can be run as local file normally about in June, but now cannot

Opened this issue · 13 comments

I don't use the p5.js online editor because of some network access restrictions.
Instead, I opened index.html directly on my Macbook and called the sketch.js file.
A month or two ago, before ML5 was updated, I could use the above method to remotely call ml5.js, but now it doesn't work and there's no response.
I tried calling ml5.js remotely in Codepen, but it didn't work too. Can only using p5.js online editor call ml5.js?

always prompt: SyntaxError: Unexpected token '?', and Unhandled Promise Rejection: ReferenceError: Can't find variable: ml5

if change the version of ml5.js to v0.12.2, then these is no any error prompt, but also no any result~

Hi @Chen-Yongdong! Thanks for submitting this issue, you should be able to still call ml5.js remotely and outside of the p5.js online editor. Can you try replacing the ml5.js script version to the following in your index.hmtl file: <script src="https://unpkg.com/ml5@0.12.2/dist/ml5.min.js"></script>? If you could also share the script tag you replace that also might be helpful to help debug :)

Also I see you said that you already changed the version to v.0.12.2, so you might have already tried this but will link to this issue related to errors with ml5.js code

Also I see you said that you already changed the version to v.0.12.2, so you might have already tried this but will link to this issue related to errors with ml5.js code

So, perhaps there are some issues with the latest ML5 update this time. Even older versions of ml5 may have encountered unsuccessful remote access issues due to certain settings changes

Hi @Chen-Yongdong, thank you for submitting this issue!

The update should not have affected the older version of ml5 (v.0.12.2 or below). Do you mind sharing the problematic code in your index.html and sketch.js? It would help us find the problem quickly.

You could also download the ml5.js library just like the p5.js library. Click on one of the links below and save the content as ml5.min.js:

Then, add ml5.min.js to the same folder as your index.html and sketch.js files. Now change the ml5.js script tag to <script src="./ml5.min.js"></script>.

One thing to note is both new and old versions of the ml5.js library would internally fetch model files from remote websites such as kaggle.com. If those sites are restricted, the next option is to connect to a VPN service before accessing ml5.

I am currently working on a downloadable, fully offline version of ml5.js. I will keep you updated!

I try your way, but the error prompts appear, one is Failed to load resource: favicon.ico, another is Failed to load resource: ml5.min.js.map

I try your way, but the error prompts appear, one is Failed to load resource: favicon.ico, another is Failed to load resource: ml5.min.js.map

I create a null ml5.min.js.map, the error prompt disappeared, but the program did not show the expected response

Hi @Chen-Yongdong, sorry for the late reply.

I try your way, but the error prompts appear, one is Failed to load resource: favicon.ico, another is Failed to load resource: ml5.min.js.map

These files are not needed for ml5.js to work. The favicon.ico is the web icon and ml5.min.js.map is for debugging.

Here is a HandPose sketch that uses a downloaded copy of the ml5.js library. It works on my end. Do you mind trying it on your end and letting me know whether it works? Just extract the content of the zip file and open index.HTML. handpose-example.zip

When running HandPose, the ml5.js library will automatically access 3 different sites for model binary files:

Perhaps the error is due to one or more of these sites being restricted.

Hi @Chen-Yongdong, sorry for the late reply.

I try your way, but the error prompts appear, one is Failed to load resource: favicon.ico, another is Failed to load resource: ml5.min.js.map

These files are not needed for ml5.js to work. The favicon.ico is the web icon and ml5.min.js.map is for debugging.

Here is a HandPose sketch that uses a downloaded copy of the ml5.js library. It works on my end. Do you mind trying it on your end and letting me know whether it works? Just extract the content of the zip file and open index.HTML. handpose-example.zip

When running HandPose, the ml5.js library will automatically access 3 different sites for model binary files:

Perhaps the error is due to one or more of these sites being restricted.

The old version ml5 needn't visit these websites. But, why the program cannot be run normally even if change the version of ml5.js to 0.12.2 or 0.6.1?

Hi @Chen-Yongdong, sorry for the late reply.

I try your way, but the error prompts appear, one is Failed to load resource: favicon.ico, another is Failed to load resource: ml5.min.js.map

These files are not needed for ml5.js to work. The favicon.ico is the web icon and ml5.min.js.map is for debugging.

Here is a HandPose sketch that uses a downloaded copy of the ml5.js library. It works on my end. Do you mind trying it on your end and letting me know whether it works? Just extract the content of the zip file and open index.HTML. handpose-example.zip

When running HandPose, the ml5.js library will automatically access 3 different sites for model binary files:

Perhaps the error is due to one or more of these sites being restricted.

Additionally, sometimes there may be occasional reactions, but why is the program's response speed much slower than previous versions?

Hi @Chen-Yongdong, sorry for the late reply.

I try your way, but the error prompts appear, one is Failed to load resource: favicon.ico, another is Failed to load resource: ml5.min.js.map

These files are not needed for ml5.js to work. The favicon.ico is the web icon and ml5.min.js.map is for debugging.

Here is a HandPose sketch that uses a downloaded copy of the ml5.js library. It works on my end. Do you mind trying it on your end and letting me know whether it works? Just extract the content of the zip file and open index.HTML. handpose-example.zip

When running HandPose, the ml5.js library will automatically access 3 different sites for model binary files:

Perhaps the error is due to one or more of these sites being restricted.

Thanks a lot, I can run it