-
Notifications
You must be signed in to change notification settings - Fork 5
Install from source code
git clone https://github.com/MedBot-team/NaBot --single-branch --depth 1
To run the NaBot, we need to run actions-server and chatbot-server separately. So we've separated actions, datasets, and the chatbot from each other.
Action-Server will contain actions and datasets, and Rasa-Server will contain the chatbot model and its autocorrect component.
production/
├── action-server
│ ├── actions
│ └── docker
├── datasets-server
├── events-server
├── monitoring-server
│ └── monitoring_ui
├── nginx
├── rasa-server
│ ├── docker
│ └── rasa
│ ├── data
│ ├── dictionary
│ ├── domain
│ ├── tests
│ └── train_test_split
└── streamlit-server
└── streamlit
In the rest of the document, we will install requirements and then run chatbot and action servers.
pip install --user virtualenv
python -m venv rasa_env
source rasa_env/bin/activate
pip install --upgrade pip
pip install --no-cache-dir -r production/rasa-server/requirements.txt -r production/action-server/requirements.txt
python -m spacy download en_core_web_md
Download the autocorrect module dictionaries. This dictionary consists of English and medical words.
cd production/rasa-server
python -c "import autocorrect; autocorrect.Speller('en_med')"
cd production/rasa-server/rasa
rasa train
You can also download model weights from Dropbox and then put them into models directory.
We are almost done. Now we can run the rasa and actions server.
-
Change rasa
action_endpoint:Edit
production/rasa-server/rasa/endpoints.ymlfile and then change it to the following line:
url: "http://app:5055/webhook"
to:
url: "http://localhost:5055/webhook"
- Run the Rasa server. If you would like to run the Rasa server with tokens to authenticate requests, You can add
--auth-token YOUR_TOKENat the end of the following command
cd production/rasa-server/rasa
mkdir -p logs ../autocorrect/data
rasa run --log-file logs/rasa-server.log --enable-api
-
Restoring database from dump files
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" datasets < mysql-server/datasets.sql
- Create logs directory
cd production/action-server/actions
mkdir logs
- Create
.envfile inaction-serverdirectory, to read database information:
$ cat action-server/.env
MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
SQL_USER=root
HOST=localhost
MYSQL_DATABASE=datasets
DRUG_TABLE=drugs
LAB_TABLE=labs
- Run action server
rasa run --log-file logs/action-server.log actions --actions actions
- Using curl
curl --location --request POST 'http://localhost:5005/webhooks/rest/webhook' \
--header 'Content-Type: application/json' \
--data-raw '{
"message" : "Can you give me dosage information of Abilify?",
"sender" : "default"
}'
- Use Streamlit UI
Create .env file in the streamlit directory:
$ cat ./production/streamlit-server/streamlit/.env
RASA_SERVER_URL=http://localhost:5005/webhooks/rest/webhook
Install build dependencies
python -m venv streamlit
source streamlit/bin/activate
pip install --upgrade pip
Install python development packages in the your OS. For example in the Ubuntu case: (x in the following command is your python version. It should be greater than 3.6
sudo apt install python3.x-dev build-essential
Install Streamlit:
pip install --no-cache-dir -r production/streamlit-server/requirements.txt
Run Streamlit UI:
cd ./production/streamlit-server/streamlit
streamlit run medbot_ui.py
Open the following URL in your browser
http://localhost:8501