WebDevSimplified / Face-Detection-JavaScript

1k stars 1.39k forks source link

Failed to load resource with live server on #22

Open Lorraine99 opened 4 years ago

Lorraine99 commented 4 years ago

Hi! I got error like this: Failed to load resource: the server responded with a status of 404 (Not Found) face-api.min.js:1 Uncaught (in promise) Error: failed to fetch: (404) Not Found, from url: http://127.0.0.1:5501/models/tiny_face_detector_model-weights_manifest.json at face-api.min.js:1 at face-api.min.js:1 at Object.next (face-api.min.js:1) at n (face-api.min.js:1) :5501/models/face_landmark_68_model-weights_manifest.json:1 Failed to load resource: the server responded with a status of 404 (Not Found) :5501/models/face_recognition_model-weights_manifest.json:1 Failed to load resource: the server responded with a status of 404 (Not Found) :5501/models/face_expression_model-weights_manifest.json:1 Failed to load resource: the server responded with a status of 404 (Not Found)

I clone the repository without changing anything, not sure what's wrong.

jcrommar commented 4 years ago

@Lorraine99 it looks like the issue is related to the models. I'd try to create the project from scratch rather than copying cloning. Things usually work out better for me that way and I was able to fire this up in 10 mins.

Fantantonio commented 4 years ago

It seems to be related to this:

In response to CVE-2019-11730, Firefox 68 and later define the origin of a page opened using a file:/// URI as unique. Therefore, other resources in the same directory or its subdirectories no longer satisfy the CORS same-origin rule. This new behavior is enabled by default using the privacy.file_unique_origin preference.

ref -> https://developer.mozilla.org/it/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp

for each weight file inside "models" folder called from face-api.js through script.js

Fantantonio commented 4 years ago

I think @Lorraine99 you are not using a web server. Try to put all the files inside the localhost and access them by http://localhost/path/of/file.html