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

getting error in fetching models and libraries #2

Closed
amitraja4606 opened this issue Jun 25, 2019 · 13 comments
Closed

getting error in fetching models and libraries #2

amitraja4606 opened this issue Jun 25, 2019 · 13 comments

Comments

@amitraja4606
Copy link

Hi, I downloaded your code and face-api.js library too. But when running index.html in browser I am getting blank page and below error.

face-api.min.js:1 Fetch API cannot load file:///C:/models/tiny_face_detector_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_landmark_68_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_recognition_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_expression_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Uncaught (in promise) TypeError: Failed to fetch
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)
at face-api.min.js:1
at new Promise ()
at p (face-api.min.js:1)
at lp (face-api.min.js:1)
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)

where am I missing something?
Thanks in advance.

@WebDevSimplified
Copy link
Owner

WebDevSimplified commented Jun 25, 2019 via email

@Fritskee
Copy link

@WebDevSimplified Whenever I run it on port 8000 it runs, but it NEVER kills. Even when I run force killing commands to kill all activity on port 8000. Next time I open up the browser, without even initializing a new local server, it will open up again.

Also, if I initialize it on a different port (eg. 1234) it throws errors to load the models and never runs.
SUPER confused about this. Please help!

@WebDevSimplified
Copy link
Owner

This sounds like it is a problem with the server setup you are using. Are you using live server through VSCode or some other server to load the pages?

@Fritskee
Copy link

Fritskee commented Jul 22, 2019

@WebDevSimplified I'm using python -m http.server The default port for this is 8000, but you can also set a specific port. Whenever I set a specific one it stops working...

edit: It's also sad, because it means I cannot add/adjust the code and play around with it. Eg. when I set it up to estimate gender and age, it also doesn't update. (yes I did save the file before running again)

@WebDevSimplified
Copy link
Owner

I am not familiar with that library, but most likely you need to configure the server so that the models are accessible via url as well.

@Fritskee
Copy link

what do you mean accessible via urls? I'm giving it the direct path to the models. Even when I delete the entire folder with everything in it, kill my localhost:8000 (from terminal) and then check localhost:8000 it keeps connecting.

@WebDevSimplified
Copy link
Owner

The face-api library works by accessing the models via a URL, so your models must be available at that URL. For example localhost:8000/models/model_name.json. If your server does not also serve the models via URL it will not work. The path to the load models function is just a relative path to the current URL you are on.

@Fritskee
Copy link

@WebDevSimplified solved, for some reason they were cached in my chrome browser. When I do incognito it works correctly, or when I do "disable cache" in dev tools it also works as it should...

@WebDevSimplified
Copy link
Owner

That makes sense. You can also press ctrl + r to do a hard refresh which clears your cache.

@duttanaman1
Copy link

I am running a file using xampp server coded in php. I am facing this issues. Is there any way that the face.api work in xampp server

@VikramKharvi
Copy link

Any workaround if we wish to run it without the server?

@d3M0N-wq
Copy link

Any workaround if we wish to run it without the server?

no use xampp server. https://www.apachefriends.org/download.html

@duclm3
Copy link

duclm3 commented Dec 3, 2020

just install the live server in visual code
https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer

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

7 participants