manu-sapiens commited on
Commit
ec62995
·
1 Parent(s): 92b816d

Trying to get the clone from omnitool version working

Browse files
Files changed (4) hide show
  1. Dockerfile +8 -8
  2. myNodeServer.js +12 -4
  3. omnitool +0 -1
  4. omnitool_init.sh +44 -0
Dockerfile CHANGED
@@ -4,14 +4,14 @@ USER node
4
  WORKDIR /app
5
 
6
  RUN chmod 777 /app
7
- RUN mkdir -p /app/omnitool
8
- RUN chmod 777 /app/omnitool
9
- RUN mkdir -p /app/omnitool/node_modules
10
- RUN chmod 777 /app/omnitool/node_modules
11
- RUN mkdir -p /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/
12
- RUN chmod 777 /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/
13
- RUN curl -L https://github.com/omnitool-ai/omnitool/raw/main/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1 -o /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1
14
- RUN chmod 777 /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1
15
 
16
  RUN chown -Rh $user:$user /app
17
  #RUN chown -Rh $user:$user /app/omnitool
 
4
  WORKDIR /app
5
 
6
  RUN chmod 777 /app
7
+ #RUN mkdir -p /app/omnitool
8
+ #RUN chmod 777 /app/omnitool
9
+ #RUN mkdir -p /app/omnitool/node_modules
10
+ #RUN chmod 777 /app/omnitool/node_modules
11
+ #RUN mkdir -p /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/
12
+ #RUN chmod 777 /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/
13
+ #RUN curl -L https://github.com/omnitool-ai/omnitool/raw/main/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1 -o /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1
14
+ #RUN chmod 777 /app/omnitool/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1
15
 
16
  RUN chown -Rh $user:$user /app
17
  #RUN chown -Rh $user:$user /app/omnitool
myNodeServer.js CHANGED
@@ -3,7 +3,7 @@
3
  * All rights reserved.
4
  */
5
  //@ts-check
6
- const VERSION = '0.6.0.hf.009d';
7
 
8
  const express = require('express');
9
  const http = require('http');
@@ -14,6 +14,7 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
14
 
15
  const app = express();
16
 
 
17
  const CONTAINER_HOST = '127.0.0.1';
18
  const OMNI_URL = 'http://127.0.0.1:1688'; // URL of the OMNITOOL service
19
  const PROXY_PORT_OMNITOOL = 4444;
@@ -64,7 +65,13 @@ const COMMON_STYLES = `
64
  background-color: yellow;
65
  color: black;
66
  font-weight: bold;
67
- }
 
 
 
 
 
 
68
  .button-like-link {
69
  display: inline-block;
70
  background-color: #f0f0f0; /* Button color */
@@ -87,6 +94,7 @@ const COMMON_STYLES = `
87
  }
88
  </style>`;
89
 
 
90
  async function startOmnitoolServer()
91
  {
92
  if (global.ALREADY_STARTING) return;
@@ -95,7 +103,7 @@ async function startOmnitoolServer()
95
  console.log('Starting Omnitool Server...');
96
  return new Promise((resolve, reject) =>
97
  {
98
- const omnitoolStartProcess = spawn('./omnitool_start.sh');
99
  omnitoolStartProcess.stdout.on('data', (data) =>
100
  {
101
  global.logs.push(data.toString());
@@ -365,7 +373,7 @@ async function handleGetRoot(req, res)
365
  if (!req.session.isVisited)
366
  {
367
  console.log('First time visitor');
368
- const gotoButtonClass = 'highlight-button';
369
 
370
  let buttonsHTML = `
371
  <button id="exitIframeButton" class="${gotoButtonClass}" onclick="exitIframe()">GOTO OMNITOOL</button>
 
3
  * All rights reserved.
4
  */
5
  //@ts-check
6
+ const VERSION = '0.6.0.hf.010b';
7
 
8
  const express = require('express');
9
  const http = require('http');
 
14
 
15
  const app = express();
16
 
17
+ const OMNITOOL_INSTALL_SCRIPT = './omnitool_init.sh'; // './omnitool_start.sh';
18
  const CONTAINER_HOST = '127.0.0.1';
19
  const OMNI_URL = 'http://127.0.0.1:1688'; // URL of the OMNITOOL service
20
  const PROXY_PORT_OMNITOOL = 4444;
 
65
  background-color: yellow;
66
  color: black;
67
  font-weight: bold;
68
+ }
69
+ .highlight-button-green {
70
+ animation: pulseAnimation 1s infinite;
71
+ background-color: green;
72
+ color: black;
73
+ font-weight: bold;
74
+ }
75
  .button-like-link {
76
  display: inline-block;
77
  background-color: #f0f0f0; /* Button color */
 
94
  }
95
  </style>`;
96
 
97
+
98
  async function startOmnitoolServer()
99
  {
100
  if (global.ALREADY_STARTING) return;
 
103
  console.log('Starting Omnitool Server...');
104
  return new Promise((resolve, reject) =>
105
  {
106
+ const omnitoolStartProcess = spawn(OMNITOOL_INSTALL_SCRIPT);
107
  omnitoolStartProcess.stdout.on('data', (data) =>
108
  {
109
  global.logs.push(data.toString());
 
373
  if (!req.session.isVisited)
374
  {
375
  console.log('First time visitor');
376
+ const gotoButtonClass = 'highlight-button-green';
377
 
378
  let buttonsHTML = `
379
  <button id="exitIframeButton" class="${gotoButtonClass}" onclick="exitIframe()">GOTO OMNITOOL</button>
omnitool DELETED
@@ -1 +0,0 @@
1
- Subproject commit 8cc31bba952351a937b58b010635022f01ccff06
 
 
omnitool_init.sh ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "--- START ---"
3
+
4
+ echo "--- GIT OMNITOOL ---"
5
+ git clone https://github.com/omnitool-ai/omnitool
6
+
7
+ chmod 777 ./omnitool
8
+ chown -Rh node ./omnitool
9
+
10
+ mkdir -p ./omnitool/node_modules
11
+ chmod 777 ./omnitool/node_modules
12
+ chown -Rh node ./omnitool/node_modules
13
+
14
+ echo "--- CHECKING EXISTING /DATA ---"
15
+ if [ -d "/data" ]; then
16
+ echo "$(ls -l /data)"
17
+ echo "$(ls -l /data/files)"
18
+
19
+ echo "--- CREATING the SYMLINK to /DATA ---"
20
+ if [ -d "./omnitool/packages/omni-server/data.local" ]; then
21
+ rm -rf ./omnitool/packages/omni-server/data.local
22
+ fi
23
+ mkdir ./omnitool/packages/omni-server/data.local
24
+ chown -Rh node ./omnitool/packages/omni-server/data.local
25
+
26
+ # Create the symlink
27
+ echo "--- Create the symlink ---"
28
+ ln -s /data ./omnitool/packages/omni-server/data.local
29
+ chown -Rh node ./omnitool/packages/omni-server/data.local
30
+ else
31
+ echo "--- NO persistent /DATA DETECTED. You can add 20Gig of persistent storage as a paid option to Hugging Face"
32
+ fi
33
+
34
+ echo "--- CD OMNITOOL ---"
35
+ cd omnitool
36
+
37
+ echo "--- YARN INSTALL ---"
38
+ yarn
39
+
40
+ chown -Rh node .
41
+ chmod -R 777 .
42
+
43
+ echo "--- YARN START ---"
44
+ yarn start -u -rb -R blocks