blob: cd618e03e2536d6a886923a52955c4bb0016cabd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# live cortex
Cortex relay chain for doing IPC with Pix2Pix running on a faraway server.
## Requirements
* Zeromq (apt/brew install zeromq)
* node 8.x
* `npm install`
* `npm install -g babel-cli webpack-cli`
* python 3.x
* `pip install -R requirements.txt`
## Four components
### ZeroRPC API wrapper
To be inserted into Pix2pix or another dynamic image generation script. Should accept changes in parameters, and send a continuous stream of images. Scripts using this wrapper should be sure not to block, i.e. call `gspawn.sleep()` instead of `time.sleep()`.
### Local websocket relay
For the time being it just seems easier to have a websocket relay that can forward ZeroRPC traffic to our remote server, and keep running even if we aren't running pix2pix. Think of this as the local cortex daemon. In the future it will have other modules for running scripts from these different libraries.
### Remote websocket relay / app server
Receives a stream of images from the local relay and forwards them on to the client. Forwards client's API changes. Possibly stores presets and renders, records usage, etc.
### Web frontend
Webpage that displays the latest images from pix2pix that have been streamed in, and also has a bunch of sliders to control parameters and things.
## Installation
### RPC Server
```
npm install
```
### Web server / relay / database
```
NODE_ENV=production npm install
./node_modules/knex/bin/cli.js migrate:latest
pm2 --name lens start npm -- run server
```
### Local proxy
Add the following to your `.env` to proxy to an intermediary server, which will then act as the database.
```
RELAY_REMOTE=http://spawn.asdf.us/client
PROXY_REMOTE=spawn.asdf.us
EXPRESS_CONNECTS_TO_RELAY=true
CACHE_SYSCALLS=true
PROXY_CACHE=true
DEBUG_PROXY=true
```
Then run the server as usual:
```
npm run server
```
|