Load face-api.js models from specific virtual directory - face-api

i'm looking for solution to put models of face-api.js inside my own virtual directory. Under wwwroot of my IIS, i have a virtual directory named face with following file and folder:
face
images/
js/
models/
output/
index.html
web.config
From index.html, I load the model on page ready as follow
const MODEL_URL = '/models'
await faceapi.loadSsdMobilenetv1Model(MODEL_URL)
await faceapi.loadFaceLandmarkModel(MODEL_URL)
await faceapi.loadFaceRecognitionModel(MODEL_URL)
await faceapi.loadFaceExpressionModel(MODEL_URL)
I expect face-api.js would load models from 'localhost/face/models' but it keep loading from 'localhost/models'. Any solution on this?

Related

In NestJS useStaticAssets in non-public folder

I have this code in main.ts
const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.useStaticAssets(join('public'));
Root folders:
|-public
|-uploads
|...
Path for upload in Multer:
const path = `./uploads/MYIMAGES`;
It works and Url I use to get image:
${process.env.REACT_APP_BACKEND_URL}/uploads/MYIMAGES/image.jpeg
So it looks like it pointed to public folder by default.
The question is: How make it works if upload images in
./uploads folder (in root, not /uploads in public)
(Sorry if it is stupid question, I'm pretty new in NestJS)

Deploy VueJS App in a sub-directory or sub-path

I’m experiencing problems deploying a Vue JS app built using the Webpack CLi to work.
If uploaded in a root directory everything renders fine, but inside a subfolder, all the links break.
I want deploy VueJS App to this url :
https://event.domain.net/webinar
I have added publicPath in vue.config.js :
var path = require(‘path’)
module.exports = {
publicPath: ‘./’
}
But only the css and js folders point to the path /webinar.
For assets, fonts and others still point to the subdomain https://event.domain.net.
CSS and JS point to path /webinar
Asset, fonts still point to subdomain https://event.domain.net/
Console
use value of publicPath as /webinar that should work.
More details are here https://cli.vuejs.org/config/#publicpath
you can configure publicPath even based on environment.
Sagar Rabadiya pointed you to the right link:
create a file called vue.config.js in the project root (where your package.json is located).
prompt the following code snippet inside:
module.exports = {
publicPath: process.env.NODE_ENV === 'production'? '/your-sub-directory/' : '/'
}
and save the file.
Open a terminal and navigate to your project, then run npm run build to generate a production build from it.
As soon as the production build has been generated, copy the contents from it and paste it in the sub-directory you created in the root folder. For example, if you use Apache, the default root directory is the htdocs folder. I've also created a virtual host on the server, maybe you also need to do this.
Open the browser and type the address where your sub-directory lives. For example: http://your-server-url:your-port/your-sub-directory/ Your should see your app now.

How can i use outside folder inside nodejs project

I am creating website using nodejs. i have lot of default js and css files from out of nodejs project file like assets. already i have created one public folder but i can not paste that folder inside that because that folder size is very big.how to call that files inside nodejs project.
folder structure:
assets
nodeproject
node_modules
public
views
index.js
package.json
package-lock.json
my assets folder have lot of css and html files like:
assets
1.style1.css
1.style2.css
1.style3.css
templatefolder:-
template1.html
template2.html
index.js:
const express=require('express');
const app=express();
app.listen(4600);
app.use(express.static('public'));
/*app.use(express.static('assets')); not working */
app.set('view engine','ejs');
app.get('/',(req,res)=>{
res.render("home");
});

Node.js with Chaplin: structure

How is the file structure like when using Chaplin with node.js?
I've downloaded the brunch-with-chaplin and that seems pretty straight-forward, but where do I place my node.js files?
I have my app.js file for node, but where do I place it and how do I launch my Chaplin app with it? I wouldn't like to mix the server side files with chaplin files..
They should be either placed directly in the root e.g. I typically have a server.js file which resides in the root. Then optionally you would have sub-directories such as controllers, models, routes etc. depending on how you decide to structure your solution.
Here's an example of a project I'm working on right now.
/app - this contains you front-end application logic i.e. chaplin
/controllers
/lib
/models
/views
application.js
routes.js
/controllers
/models
/routes
server.js - node.js main, starts up express/connect etc.

Yii front and backend common structure and access to link and htaccess settings

I m beginner in yii
I have created one structure to handle files for frontend and backend so that common files can be used for both and different files form their folder
framework/ (This folder will contain all yii framework core folders and files)
assets/
js/
frontend/
common/
backend/
api
images/
storage/
protected/
components/
config
main.php (DB, emails, etc...)
controllers/
frontend/
backend/
views/
frontend/
backend/
models/
extensions/
modules/
runtime/
index.php
.htaccess
this structure is created for booking application.
Some common files are shared between them it will be there in controller/ and views/
and differnrt file will be in controller/frontend/ and controller/backend/
Example
I have files in both folder as below
controller/
SiteController.php
Frontend/SiteController.php
Backend/SiteController.php
views/
layouts/
Frontend/layouts
Backend/layouts
Now the question is how can i set .htaccess so that
when i write http://myapp.com/index.php --> will access all files for frontend
and
http://myapp.com/backend/inex.php --> will access backend files (beckend views and controller)
Copy .htaccess and index.php to [/backend/] folder. Then in new index.php change path to the config, different to main one. E.g.
$config=dirname(__FILE__).'/../../'.YII_PROTECTED.'/config/admin.production.php';
And create own config for the backend independently.
So you can use any common views, controllers or models, but most importantly to control it with UrlManager. Here's an example from my personal site (you can test its URL logic externally):
Frontend:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'urlSuffix' => '/',
'rules'=>array(
'<controller:profile>/' => '<controller>/index/',
'<controller:profile>/<action:cv>/<project:\w+>' => '<controller>/portfolio/',
'<controller:profile>/<action>' => '<controller>/<action>/',
'<controller:blog>/' => '<controller>/index/',
'<controller:blog>/<postID:[0-9]+>.html' => '<controller>/post/',
),
),
Backend:
'rules'=>array(
'/' => 'autoadmin/default/index',
'<controller:\w+>' => 'autoadmin/<controller>/index',
'<controller:\w+>/<action:\w+>' => 'autoadmin/<controller>/<action>',
),
The Backend looks into AutoAdmin CMS, which executes as a module.
The both use the same file structure, but each can use anything common (most probably it would be models).

Resources