From d87d927d9dcdbb390b115594fc2ea121adcbdd47 Mon Sep 17 00:00:00 2001 From: Selfsigned Date: Fri, 10 May 2024 07:26:55 +0200 Subject: [PATCH] Add InvokeAI --- app.js | 20 ++++++++++++++++++++ public/config.json | 3 ++- public/index.html | 7 +++++++ public/script.js | 12 ++++++++++++ scripts/start_invokeai.sh | 2 ++ scripts/stop_invokeai.sh | 2 ++ 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 scripts/start_invokeai.sh create mode 100755 scripts/stop_invokeai.sh diff --git a/app.js b/app.js index 48feafd..64d48d5 100644 --- a/app.js +++ b/app.js @@ -65,6 +65,26 @@ app.get('/start_comfyui', (req, res) => { res.send('Started ComfyUI successfully!'); }); +app.get('/stop_invokeai', (req, res) => { + exec('scripts/stop_invokeai.sh &', (error, stdout, stderr) => { + if (error) { + console.error(`Error stopping InvokeAI: ${error}`); + } + }); + + res.send('Stopped InvokeAI successfully!'); +}); + +app.get('/start_invokeai', (req, res) => { + exec('scripts/start_invokeai.sh &', (error, stdout, stderr) => { + if (error) { + console.error(`Error starting InvokeAI: ${error}`); + } + }); + + res.send('Started InvokeAI successfully!'); +}); + app.listen(PORT, '0.0.0.0', () => { console.log(`Server is running on http://0.0.0.0:${PORT}`); }); diff --git a/public/config.json b/public/config.json index ec68ef1..7511c69 100644 --- a/public/config.json +++ b/public/config.json @@ -2,6 +2,7 @@ "applications": [ "A1111", "Kohya_ss", - "ComfyUI" + "ComfyUI", + "InvokeAI" ] } \ No newline at end of file diff --git a/public/index.html b/public/index.html index a1d71f1..5355330 100644 --- a/public/index.html +++ b/public/index.html @@ -41,6 +41,13 @@

RunPod Application Manager

+ + InvokeAI + + + + + diff --git a/public/script.js b/public/script.js index 7804675..ea29676 100644 --- a/public/script.js +++ b/public/script.js @@ -45,4 +45,16 @@ $(document).ready(function() { alert(data); }); }); + + $('#stopInvokeAI').click(function () { + $.get('/stop_invokeai', function (data) { + alert(data); + }); + }); + + $('#startInvokeAI').click(function () { + $.get('/start_invokeai', function (data) { + alert(data); + }); + }); }); diff --git a/scripts/start_invokeai.sh b/scripts/start_invokeai.sh new file mode 100755 index 0000000..40afdc9 --- /dev/null +++ b/scripts/start_invokeai.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +cd /workspace/InvokeAI && source venv/bin/activate && nohup invokeai-web > /workspace/logs/invokeai.log 2>&1 & diff --git a/scripts/stop_invokeai.sh b/scripts/stop_invokeai.sh new file mode 100755 index 0000000..2b04307 --- /dev/null +++ b/scripts/stop_invokeai.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +fuser -k 9091/tcp \ No newline at end of file