Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Chen-Yongdong opened this issue Jul 23, 2024 · 13 comments

Comments

@Chen-Yongdong
Copy link

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
Copy link
Author

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

@Chen-Yongdong
Copy link
Author

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

@sharellb
Copy link
Collaborator

sharellb commented Jul 24, 2024

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 :)

@sharellb
Copy link
Collaborator

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

@Chen-Yongdong
Copy link
Author

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

@ziyuan-linn
Copy link
Member

ziyuan-linn commented Jul 28, 2024

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!

@Chen-Yongdong
Copy link
Author

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
Copy link
Author

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

@ziyuan-linn
Copy link
Member

ziyuan-linn commented Aug 6, 2024

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.

@Chen-Yongdong
Copy link
Author

@Chen-Yongdong
Copy link
Author

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?

@Chen-Yongdong
Copy link
Author

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?

@Chen-Yongdong
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants