ml5-next-gen icon indicating copy to clipboard operation
ml5-next-gen copied to clipboard

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

Open Chen-Yongdong opened this issue 1 year ago • 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?

Chen-Yongdong avatar Jul 23 '24 12:07 Chen-Yongdong

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

Chen-Yongdong avatar Jul 24 '24 13:07 Chen-Yongdong

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

Chen-Yongdong avatar Jul 24 '24 14:07 Chen-Yongdong

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/[email protected]/dist/ml5.min.js"></script>? If you could also share the script tag you replace that also might be helpful to help debug :)

sharellb avatar Jul 24 '24 18:07 sharellb

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

sharellb avatar Jul 24 '24 18:07 sharellb

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

Chen-Yongdong avatar Jul 26 '24 23:07 Chen-Yongdong

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!

ziyuan-linn avatar Jul 28 '24 03:07 ziyuan-linn

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

Chen-Yongdong avatar Jul 29 '24 14:07 Chen-Yongdong

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

Chen-Yongdong avatar Jul 29 '24 14:07 Chen-Yongdong

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:

  • https://tfhub.dev (This should cause a redirect to Kaggle.com)
  • https://www.kaggle.com
  • https://storage.googleapis.com

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

ziyuan-linn avatar Aug 06 '24 20:08 ziyuan-linn

  • https://storage.googleapis.com

Yes, https://storage.googleapis.com/ cannot be visited

Chen-Yongdong avatar Aug 13 '24 09:08 Chen-Yongdong

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:

  • https://tfhub.dev (This should cause a redirect to Kaggle.com)
  • https://www.kaggle.com
  • https://storage.googleapis.com

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?

Chen-Yongdong avatar Aug 13 '24 12:08 Chen-Yongdong

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:

  • https://tfhub.dev (This should cause a redirect to Kaggle.com)
  • https://www.kaggle.com
  • https://storage.googleapis.com

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?

Chen-Yongdong avatar Aug 13 '24 12:08 Chen-Yongdong

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:

  • https://tfhub.dev (This should cause a redirect to Kaggle.com)
  • https://www.kaggle.com
  • https://storage.googleapis.com

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

Thanks a lot, I can run it

Chen-Yongdong avatar Aug 14 '24 11:08 Chen-Yongdong

i believe this is resolved, closing the issue!

shiffman avatar Jul 30 '25 02:07 shiffman