|
|
|
# Local setup
|
|
|
|
Developers can run Web-BAMT manually on local machine.
|
|
|
|
In order to do this, follow these steps:
|
|
|
|
## Install Web-BAMT
|
|
|
|
Install Web-BAMT from [here](https://github.com/ITMO-NSS-team/Web-BAMT) : <br>
|
|
|
|
`git clone https://github.com/ITMO-NSS-team/Web-BAMT`
|
|
|
|
|
|
|
|
## Install backend dependencies
|
|
|
|
_We highly recommend using virtual enviroment._ <br>
|
|
|
|
Install Python >=3.9, <3.11. Then install everything from `requirements.txt`: <br>
|
|
|
|
`pip install -r requirements.txt` <br><br>
|
|
|
|
Install BAMT (special version for web) from [here](https://github.com/Roman223/bamt_special) to `../site-packages/bamt` directory of virtual
|
|
|
|
enviroment: <br>
|
|
|
|
`git clone https://github.com/Roman223/bamt_special`<br>
|
|
|
|
### Set up BAMT
|
|
|
|
Take care of BAMT's config: `selbst.ini`. Nodes must be a directory where models of logit nodes store (it can be any directory), Log must be absolute path to log file of BAMT. Default log is inside bamt_special repo, called `logging.conf`.<br>
|
|
|
|
|
|
|
|
## Install frontend dependencies
|
|
|
|
_If npm is not installed, follow [instructions ](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)._ <br><br>
|
|
|
|
Move to "frontend" folder and run:<br>
|
|
|
|
`npm config set fetch-retry-mintimeout 2000000`<br>
|
|
|
|
`npm config set fetch-retry-maxtimeout 12000000`<br>
|
|
|
|
`npm set timeout=10000000`<br><br>
|
|
|
|
|
|
|
|
`npm install --legacy-peer-deps --loglevel verbose`<br>
|
|
|
|
|
|
|
|
## First run
|
|
|
|
### Add enviroment variables
|
|
|
|
`set FLASK_APP=main.py`
|
|
|
|
### Run Web-BAMT API
|
|
|
|
Move to Web-BAMT folder and run:<br>
|
|
|
|
`flask run` <br>
|
|
|
|
This run a local backend API. You can either run each server in terminal or run it as back process using `nohup`: <br>
|
|
|
|
`nohup flask run > log.txt 2>&1 &\`. <br>
|
|
|
|
**Note that frontend and backend must be on different ports. You can use `flask run --port=xxxx` to set port for API.**
|
|
|
|
|
|
|
|
## Set up frontend
|
|
|
|
Open `frontend/.env.development` and passed the adress of API, it can be found in output of `flask run` (usually `http://localhost:5000`).
|
|
|
|
|
|
|
|
### Run frontend
|
|
|
|
Move to 'frontend' folder and run: <br>
|
|
|
|
`yarn start` <br>
|
|
|
|
This run a local frontend. You can either run each server in terminal or run it as back process using `nohup` the same as API.
|
|
|
|
|
|
|
|
## Start verification
|
|
|
|
### Front
|
|
|
|
Go to adress from output of frontend server. There should be an authorization page.
|
|
|
|
### Back
|
|
|
|
Create and run `test.py` with query to API:
|
|
|
|
```
|
|
|
|
import requests
|
|
|
|
BASE = '<YOUR_API>' # usually http://127.0.0.1:5000
|
|
|
|
assert requests.get(f"{BASE}/api/htest/health").status_code == 200
|
|
|
|
print("OK")
|
|
|
|
```
|
|
|
|
|
|
|
|
# Pass custom dataset to Web-BAMT
|
|
|
|
Go to `app/api/experiment/controller.py` and find snippet (52-55): <br>
|
|
|
|
```
|
|
|
|
if case_id == 0:
|
|
|
|
directory = r"data/hack_processed_with_rf.csv"
|
|
|
|
elif case_id == 1:
|
|
|
|
directory = r"data/vk_data.csv"
|
|
|
|
```
|
|
|
|
turn it into something like (don't forget about conditions dataset must meet):
|
|
|
|
```
|
|
|
|
directory = r"data/<YOUR_DATASET.csv>"
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|