For a school project I am trying to create a face recognition tool. To create this I used this tutorial.
The code runs fine in Visual Studio code with live server (running live server is a key but I can't figure out why this is so important)
But now I'm trying to put my work on a real server (server is granted to us by school). But when I upload all the files to my school server the console says it couldn't find the right models. The link the console tries to fetch the files from seems right so I'm confused and can't figure out what the problem is.
Code that loads the models:
Promise.all([
faceapi.nets.tinyFaceDetector.loadFromUri('./models'),
faceapi.nets.faceLandmark68Net.loadFromUri('./models'),
faceapi.nets.faceRecognitionNet.loadFromUri('./models'),
faceapi.nets.faceExpressionNet.loadFromUri('./models'),
]).then(startVideo)
Server build-up:
Console error log:
Have another check that the file path you have provided is correct. For example, it may work locally with just ('./models'). But check if the school server requires you to provide the root file path. Let me know if this works.
I would recommend a generic approach to this issue, for didacting reasons.
You can to use ProcMon from Microsoft SysUtils. It can monitor any application for file system activity like reading directories or files. I recommend to use it to check where your application is actually reading from and where those paths are pointing to.
Related
I followed some instructions,so cesium running locally
and then did hello world example like this
But I cannot see anything when i clicked open in browser. I failed constantly
I don't know what can i do.
From your images, it looks like your Cesium development server is running on port 8080. However, your web browser is simply viewing the local HTML file through its filesystem path (C:\Users\GSY\...) and not through the server. You need to serve your HTML file through http://localhost:8080/ and enter the path to the HTML file relative to where you started the server from. For example, if you started the server in C:\Users\GSY\Desktop, you should try URL http://localhost:8080/helloworld/hello1.html.
I have no idea what your filesystem setup actually is, so you'll need to adjust the URLs based on your system and where you installed things.
However, based on a very quick glance at the Cesium JS quickstart page, you haven't set up your environment properly with an API token, and at any rate you haven't instructed the page to show anything, so it's not surprising the page is blank. I strongly suggest reading through the quickstart examples and looking at the API documentation to understand how to use this tool.
Forgive me if this is a silly question but I could really use advice on the direction to look at for a project I am working on.
I made a webserver that streams RTSP to a webpage using LAMP, php and mysql; and served a html template. This was done on a raspberry pi and it all works fine as is. Also done on an Ubuntu VM.
EXAMPLE I FOLLOWED: https://www.thewebblinders.in/programming/article/rtsp-streaming-on-a-web-browser-6069
The next part of my project was to add buttons to the html page, that when pressed send a universal protocol command. I found that I needed to do this using IPC (inter-process communication) however I'm not really sure how to implement this to what I have now.
At the moment my system works simply as a html webpage that is served from /var/www/html using npx http-server --cors (from the open source server environment NODE.js)
I'm not really sure how I could implement a python or javascript back end that communicates to something like electron.js (I tried the latter method but had no success).
Would it be a separate program that acts as a server that hosts the html page instead of Node.js? Would I still keep my templates and methods in the LAMP src directory (/var/www/html)?
Any advice on the possible direction I could look at would be a lot of help. I've not found much online that discusses IPC work on html templates served by node.js. The only html related topic I've seen relating to it is JavaScript with electron.js and that changes the way my webserver is ran.
Thanks for taking the time.
My live server on visual studio keeps opening an old html file when i try to open my current one. Ive tried reinstalling the extension but its the same problem. Can anyone help please
i cannot have two project folders with an html file running through the live server. Only one html file can be streamed at one time other wise when trying to stream the second, it will stream the first (Like the issue i was having)
I was having the same problem but later on I find out that, I renamed my project folder while my server was still loading the same project but with the previous folder name so I changed the link to my new folder folder name and it worked for me.
I have live server will simply not work if there was an error in JavaScript file.
Even if you do an alert in the beginning of JavaScript file (for test purposes) but at the end of the file re-define a variable which was already defined before, this error will render liver server not working.
The html page will not respond as well.
Solution is to go to developer tools (F12), see the errors on console, fix them and save and the live server would be back in action! At least that was the case with me.
I had the same issue, sometimes it was an error on the console, or keep showing an old HTML, tried everything, deleting cookies, reinstalling everything and nothing worked,
Eventually, it worked with a hard refresh, what it really worked was to
Go to ---> vs code settings ----> extensions ---> live server config set as chrome private. So far no more errors!
The liveserver extension serves static pages like html files and it does not load javascript or typescript files. You need to setup a server yourself for example in react you use webpack to configure your local server and your app runs on a localhost:port. In a nutshell, you need to write a script for node to run your js files. And you won't need liveserver after that.
I was working on a Angular JS project. Basically it is a purchased theme with Angular JS, HTML, Bootstrap etc. when i tried to run it directly on browser it is broken. but when i run the same in my local server, it works fine.
I understand the importance of setting up a local server when we work on a project with server side language like PHP, .NET. what i am really confused is, why do we need to set up local server to run javascript or any javascript frame work?
Thanks in Advance.
I would like to do these examples by access "file:///C:/TempProjects/GameOfCards/index.html#/" on local computer, but most browsers cannot access these files on local computer do to Cross Origin issues. Here a StackOverflow question and answer that describes this issue: Cross origin requests(CORS) are only supported for HTTP but it’s not cross-domain. So we need a web server
There is another way, by adding a switch in your browser(chrome in this case)-
--allow-file-access-from-files
But, I suggest, running a simple server is the best way of working with things. Hope it helps. Happy Coding.
it happened for me . and I got that , when you run a js project directly , the address of some dependencies will change . for example your index is in c://www directory . if you want to open a html file which it's address in routing is in
c://www/public/... the routing would be different . because when run on a server the www directory is running and your home directory is that . but when you run directly, your home directory is where your index file is ...
I am working on project for desktop application. I am using Qt controls with visual c++.
I am loading an html file in the QWebView as,
m_pWebView->load(QUrl("../../../demo/index_Splash_Screen.html"));
Now, what i want is, say, I have some .zip files in my location "c:\demo", I want list (or array of file names) of the files present in that directory.
How can i do this through javascript ?
PS: I went through this link, but it didnt match my requirement. I have not worked with of html, javascript and jquery. Please help me.
I'm afraid you cannot access local files or directories using javascript due to security issues.
Edit: I hadn't thought about the file api so thought for a moment this might not be true, but without some user input to give permission, this still cannot be done.
This question has a good response from PhilNicholas:
I'm afraid I may be the bearer of bad news for your design: The action
you are requesting expressly violates the security model as specified
in the File API spec. The client implementation of FileReader() must
make sure that "all files that are being read by FileReader objects
have first been selected by the user." (W3C File API , 13. Security
Considerations: http://www.w3.org/TR/FileAPI/#security-discussion).
It would be a huge security risk of browser scripts could just
arbitrarily open and read any file from a path without any user
interaction. No browser manufacturer would allow unfettered access to
the entire file system like that.
Thinking about it however, if it is all being run locally, you could use ajax to query a server side script that could return the directory you request.
If it is a Windows application then you could access the local filesystem by using ActiveX objects. You might have a look at this link Reading a txt file from Javascript
Note that activeX usage is possible only when using IE as browser/engine; I used to need it a while ago for developing an HTML application (.hta files).