Skip to content

Commit

Permalink
switch to poetry, upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ancalita committed Feb 25, 2023
1 parent 6c6735d commit c332b9b
Show file tree
Hide file tree
Showing 4 changed files with 562 additions and 12 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ The chatbot has been trained on an edited conversation using material from this
In order to run the project locally, you will need to take the following steps:

1. git clone project on your local machine
2. create virtual environment in Terminal or Command Prompt: `python3 -m venv anticorruption-bot`
2. create virtual environment in Terminal or Command Prompt: `python -m venv anticorruption-bot`
3. activate virtual environment:
- Mac command: `source anticorruption-bot/bin/activate`
- Windows command: `anticorruption-bot\Scripts\activate`
4. install requirements: `pip install -r requirements.txt`
5. change database_uri in line 11 of bot.py module to your database location, or remove to use default sqlite3 database.
6. sign up to [Twilio](https://www.twilio.com/try-twilio) & follow instructions
7. download ngrok
8. in the Terminal/Command Prompt window where you activated the virtual env, run command: `python3 bot.py`
9. open new Terminal/Command Prompt window, cd in the folder where you unzipped ngrok download, run command: `ngrok http 500`
10. Copy paste the http ngrok URL mapped to localhost:5000 in Twilio WhatsApp Sandbox Settings, against the input required for WHEN A MESSAGE COMES IN form field.
4. install [Poetry dependency management tool](https://python-poetry.org/docs/1.2/#installation)
5. install requirements: `poetry install`
6. change `database_uri` in line 11 of bot.py module to your database location, or remove to use default sqlite3 database.
7. sign up to [Twilio](https://www.twilio.com/try-twilio) & follow instructions
8. download ngrok
9. in the Terminal/Command Prompt window where you activated the virtual env, run command: `python3 bot.py`
10. open new Terminal/Command Prompt window, cd in the folder where you unzipped ngrok download, run command: `ngrok http 500`
11. copy-paste the http ngrok URL mapped to `localhost:5000` in Twilio WhatsApp Sandbox Settings, against the input required for WHEN A MESSAGE COMES IN form field.

Enjoy!
4 changes: 0 additions & 4 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from twilio.twiml.messaging_response import MessagingResponse
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
import os

chatbot = ChatBot("Anticorruption",
Expand All @@ -16,9 +15,6 @@
BotMemory = open('base/' + knowledge, 'r').readlines()
trainer.train(BotMemory)

# corpus_trainer = ChatterBotCorpusTrainer(chatbot)
# corpus_trainer.train("chatterbot.corpus.english")

app = Flask(__name__)


Expand Down
Loading

0 comments on commit c332b9b

Please sign in to comment.