Initial commit

This commit is contained in:
henryruhs
2023-11-27 00:09:36 +01:00
commit 818e1abf6d
13 changed files with 342 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_size = 4
indent_style = tab
trim_trailing_whitespace = true
+10
View File
@@ -0,0 +1,10 @@
{
"extends":
[
"@isnotdefined/eslint-config/common"
],
"parserOptions":
{
"ecmaVersion": 2020
}
}
+2
View File
@@ -0,0 +1,2 @@
github: henryruhs
custom: https://paypal.me/henryruhs
+16
View File
@@ -0,0 +1,16 @@
name: ci
on: [ push, pull_request ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm run lint
+3
View File
@@ -0,0 +1,3 @@
.idea
.vscode
node_modules
+6
View File
@@ -0,0 +1,6 @@
FaceFusion Pinokio
==================
> Next generation face swapper and enhancer.
[![Build Status](https://img.shields.io/github/actions/workflow/status/facefusion/facefusion-pinokio/ci.yml.svg?branch=master)](https://github.com/facefusion/facefusion-pinokio/actions?query=workflow:ci)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+81
View File
@@ -0,0 +1,81 @@
function install(kernel)
{
const { platform, arch, gpu } = kernel;
if (platform === 'darwin')
{
if (arch === 'arm64')
{
return 'python install.py --onnxruntime coreml-silicon --torch default';
}
return 'python install.py --onnxruntime default --torch default';
}
if (gpu === 'nvidia')
{
return 'python install.py --onnxruntime cuda --torch cuda';
}
if (gpu === 'amd')
{
return 'python install.py --onnxruntime default --torch cpu';
}
return 'python install.py --onnxruntime default --torch cpu';
}
module.exports = async kernel =>
{
const config =
{
requires:
[
{
type: 'conda',
name:
[
'cmake',
'ffmpeg'
],
args: '-c conda-forge'
},
{
gpu: 'nvidia',
name: 'cuda'
}
],
run:
[
{
method: 'shell.run',
params:
{
message: 'git clone https://github.com/facefusion/facefusion --branch next --single-branch'
}
},
{
method: 'shell.run',
params:
{
message: install(kernel),
path: 'facefusion',
venv: 'env'
}
},
{
method: 'input',
params:
{
title: 'Install complete',
description: 'Go back to the dashboard and launch the application.'
}
},
{
method: 'browser.open',
params:
{
uri: '/?selected=facefusion'
}
}
]
};
return config;
};
+106
View File
@@ -0,0 +1,106 @@
module.exports = async kernel =>
{
const hasEnv = await kernel.exists(__dirname, 'facefusion', 'env');
const hasRepo = await kernel.exists(__dirname, 'facefusion');
let menu = [];
if (hasEnv && hasRepo)
{
if (kernel.running(__dirname, 'start.js'))
{
const session = await kernel.require(__dirname, 'session.json');
menu =
[
{
icon: 'fa-solid fa-spin fa-circle-notch',
text: 'Running ' + session.mode
},
{
icon: 'fa-solid fa-desktop',
text: 'Server',
href: 'start.js',
params:
{
fullscreen: true
}
}
];
if (session && session.url)
{
menu.push(
{
icon: 'fa-solid fa-rocket',
text: 'Open session',
href: session.url,
target: '_blank'
});
}
return menu;
}
menu =
[
{
icon: 'fa-solid fa-photo-film',
text: 'Launch default',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Default'
}
},
{
icon: 'fa-solid fa-gauge',
text: 'Launch benchmark',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Benchmark'
}
},
{
icon: 'fa-solid fa-webcam',
text: 'Launch webcam',
href: 'start.js',
params:
{
run: true,
fullscreen: true,
mode: 'Webcam'
}
},
{
icon: 'fa-solid fa-rotate',
text: 'Update',
href: 'update.js',
params:
{
run: true,
fullscreen: true
}
}
];
}
else
{
menu =
[
{
icon: 'fa-solid fa-plug',
text: 'Install',
href: 'install.js',
params:
{
run: true,
fullscreen: true
}
}
];
}
return menu;
};
+16
View File
@@ -0,0 +1,16 @@
{
"name": "facefusion-pinokio",
"description": "Next generation face swapper and enhancer",
"version": "2.0.0",
"license": "MIT",
"devDependencies":
{
"@isnotdefined/eslint-config": "9.8.0",
"eslint": "8.54.0"
},
"scripts":
{
"lint": "eslint . --ext=.js",
"fix": "npm run lint -- --fix"
}
}
+7
View File
@@ -0,0 +1,7 @@
module.exports =
{
title: 'FaceFusion Next',
description: 'Next generation face swapper and enhancer',
icon: 'icon.png',
menu: require(__dirname + '/menu.js')
};
+60
View File
@@ -0,0 +1,60 @@
module.exports = () =>
{
const config =
{
daemon: true,
cmd:
{
Default: 'python run.py',
Benchmark: 'python run.py --ui-layouts benchmark',
Webcam: 'python run.py --ui-layouts webcam'
},
run:
[
{
method: 'local.set',
params:
{
mode: '{{input.mode}}'
}
},
{
method: 'shell.run',
params:
{
message: '{{self.cmd[local.mode]}}',
path: 'facefusion',
venv: 'env',
on:
[
{
event: '/(http:\/\/[0-9.:]+)/',
done: true
}
]
}
},
{
method: 'self.set',
params:
{
'session.json':
{
mode: '{{local.mode}}',
url: '{{input.stdout.match(/(http:\\S+)/gi)[0]}}'
}
}
},
{
method: 'browser.open',
params:
{
uri: '{{self.session.url}}',
target: '_blank'
}
}
]
};
return config;
};
+27
View File
@@ -0,0 +1,27 @@
module.exports = () =>
{
const config =
{
run:
[
{
method: 'shell.run',
params:
{
'message': 'git pull'
}
},
{
method: 'shell.run',
params:
{
message: 'git pull',
path: 'facefusion'
}
}
]
};
return config;
};