This is the repository for the webserver of the 'Meinungsorgel'. If you want to run the entire Meinungsorgel, you will need access to the following repositories:
- smalldata_webserver: this one
- smalldata_classification: model training
- smalldata_proxy: a simple http-to-osc translater
- SmallData: scripts for audio (SuperCollider) and visual (Processing) representation
- run
git clone git@github.com:Regexose/SmallData.git - install python >= 3.8.0 (I recommend pyenv or virtualenv)
- run
pip install -r requirements.txt - download trained models (ideally from meinungsorgel.de) and put them in a
folder
trained_modelsin themodel_data- folder - install
postgres, create a db and a user (see Setup postgres-section in/doc/deployment.md). When using OSX, I suggest to use the PostGRes.app instead of homebrew installation - In the projects' root directory, create a copy of
settings.ini.template, call itsettings.ini. and edit with the correct values - run
python manage.py makemigrations && python manage.py migrate - Load initial data into db by
python manage.py loaddata fixtures/initial_fixture.yaml - install and start redis (
brew install redis && brew services start redis) - start the api:
python manage.py runserver
- cd into
frontend, runnpm install - inside
frontend, create a file.envwith content (or add urls of running server)REACT_APP_WS_URL = ws://localhost:8000/ws/ REACT_APP_HTTP_URL = http://localhost:8000/api/ - run
npm run start - open browser & navigate to
localhost:3000
See doc/deployment.md
- activate the python proxy - , i.e. websocket connection to forward incomming utterances to supercollider. Its located in the
smalldata_utilitiesrepo underproxy. Start it with
python proxy.py
If you have the felling something doesnt work with the communication,, try
python proxy.py --enable-trace
Start backend & frontend
`~/start_meinungsorgel.sh`
To stop, use ~/stop_meinungsorgel.sh
The language that the backend (API) uses to classify the incoming utterances is provided by the frontend: Each request
to POST:/utterances provides a langauge code (currently de or en), that the backend uses to chose the correct model.
This language code, in turn, is provided by the REACT_APP_LANGUAGE directive in the .env-file of the frontend-folder:
en: use English language for classificationde: use Germanlanguage for classificationauto: use the Browsers' language setting for classification (English if the browser language is not implemented)
In production, the langauge is changed by running the set_langauge.sh - script in
/home/smalldata/smalldata_webserver/scripts/ as smalldata:
ssh root@meinungsorgel.de
su smalldata
cd /home/smalldata/smalldata_webserver/scripts/
./set_language.sh de (bzw en / auto)
exit (ctrl+d)
~/start_meinungsorgel.sh
Warnings:
- You need to add a language code as an argument to the script, i.e. type
set_langauge.sh en(or de) - The script must be run as user
smalldata, i.e. typesu smalldatabefore - You have to restart
gunicornandnginxafterwards, or simply run/home/root/start_meinungsorgel.sh(asroot)