This package supports a Brain Computer Interface — imaginary hardware that can read minds, and upload snapshots of cognitions.
-
Clone the repository and enter it:
$ git clone https://github.com/shlomow/bubbles.git ... $ cd bubbles/
-
Run the installation script and activate the virtual environment:
$ ./scripts/install.sh ... $ source .env/bin/activate [foobar] $ # you're good to go!
-
To check that everything is working as expected, run the tests:
$ pytest tests/ ...
In order to upload snapshots to the server, you can use a cli:
$ python -m bubbles.client upload-sample \
-h/--host '127.0.0.1' \
-p/--port 8000 \
'snapshot.mind.gz'
Or, you can use the python interpreter:
>>> from bubbles.client import upload_sample
>>> upload_sample(host='127.0.0.1', port=8000, path='sample.mind.gz')
In order to run the server, you can use a cli:
$ python -m bubbles.server run-server \
-h/--host '127.0.0.1' \
-p/--port 8000 \
'rabbitmq://127.0.0.1:5672/'
Or, you can use the python interpreter:
>>> from cortex.server import run_server
>>> def print_message(message):
... print(message)
>>> run_server(host='127.0.0.1', port=8000, publish=print_message)
In order to run the parser, you can use a cli:
$ python -m bubbles.parsers parse 'pose' 'snapshot.raw' > 'pose.result'
Or, you can use the python interpreter:
>>> from bubbles.parsers import run_parser
>>> data = …
>>> result = run_parser('pose', data)
To run the parser as a service use the following cli:
$ python -m bubbles.parsers run-parser 'pose' 'rabbitmq://127.0.0.1:5672/'
In order to run the saver, you can use a cli:
$ python -m bubbles.saver save \
-d/--database 'postgresql://127.0.0.1:5432' \
'pose' \
'pose.result'
Or, you can use the python interpreter:
>>> from bubbles.saver import Saver
>>> saver = Saver(database_url)
>>> data = …
>>> saver.save('pose', data)
To run the saver as a service use the following cli:
$ python -m bubbles.saver run-saver \
'postgresql://127.0.0.1:5432' \
'rabbitmq://127.0.0.1:5672/'
In order to run the api server, you can use a cli:
$ python -m bubbles.api run-server \
-h/--host '127.0.0.1' \
-p/--port 5000 \
-d/--database 'postgresql://127.0.0.1:5432'
Or, you can use the python interpreter:
>>> from cortex.api import run_api_server
>>> run_api_server(
... host = '127.0.0.1',
... port = 5000,
... database_url = 'postgresql://127.0.0.1:5432',
... )
The api is reflected by the following cli:
$ python -m cortex.cli get-users
…
$ python -m cortex.cli get-user 1
…
$ python -m cortex.cli get-snapshots 1
…
$ python -m cortex.cli get-snapshot 1 2
…
$ python -m cortex.cli get-result 1 2 'pose'
…
You can also use a graphical user interface to consume the database:
$ python -m bubbles.gui run-server \
-h/--host '127.0.0.1' \
-p/--port 8080 \
-H/--api-host '127.0.0.1' \
-P/--api-port 5000
Or, using the python interpreter:
>>> from bubbles.gui import run_server
>>> run_server(
... host = '127.0.0.1',
... port = 8080,
... api_host = '127.0.0.1',
... api_port = 5000,
... )
In order to deploy the system we picked docker compose and you can run the following command to set it up:
$ ./scripts/run-pipeline.sh
You can watch the api reference here.