- Before installing Python Modules, it is recommended to create and use virtual environments for this project, by using the following command:
# Windows
py -3 -m venv .venv
.venv\Scripts\activate
# MacOS
python3 -m venv .venv
. .venv/bin/activate
- Run the following command to install necessary Python Modules
pip install -r requirements.txt
-
Follow the guide and install tesseract.
-
Duplicate the
config.py.example
and rename it toconfig.py
.
# Windows
copy config.py.example config.py
# MacOS
cp config.py.example config.py
-
Put your Line Bot's
CHANNEL_ACCESS_TOKEN
andCHANNEL_SECRET
, andPATH_TO_TESSERACT
command (e.g./opt/homebrew/Cellar/tesseract/5.3.3/bin/tesseract
) in the config file. -
Run the following command to start the application
flask run --debug --host 0.0.0.0 --port 5001
To connect this Web API to Line Bot, you need to hook this Web API to Line's Webhook. To tunnel your local address to public address, you need to install ngrok and run the following command to expose this application's port to public.
ngrok http 5001
Navigate to Line Developer Console Website and follow their instructions to build Line Bot Official and connect the webhook.