Skip to content

Commit

Permalink
Merge pull request #3 from selfsigned/main
Browse files Browse the repository at this point in the history
Add InvokeAI Management
  • Loading branch information
ashleykleynhans authored May 10, 2024
2 parents 5d3c3cd + d87d927 commit 907946d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
20 changes: 20 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 2 additions & 1 deletion public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"applications": [
"A1111",
"Kohya_ss",
"ComfyUI"
"ComfyUI",
"InvokeAI"
]
}
7 changes: 7 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ <h1 class="text-center">RunPod Application Manager</h1>
<button id="startComfyUI" class="btn btn-success">Start</button>
</td>
</tr>
<tr id="rowInvokeAI">
<td>InvokeAI</td>
<td>
<button id="stopInvokeAI" class="btn btn-danger">Stop</button>
<button id="startInvokeAI" class="btn btn-success">Start</button>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
12 changes: 12 additions & 0 deletions public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
2 changes: 2 additions & 0 deletions scripts/start_invokeai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
cd /workspace/InvokeAI && source venv/bin/activate && nohup invokeai-web > /workspace/logs/invokeai.log 2>&1 &
2 changes: 2 additions & 0 deletions scripts/stop_invokeai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
fuser -k 9091/tcp

0 comments on commit 907946d

Please sign in to comment.