Git Product home page Git Product logo

pythonchatbot's Introduction

pythonchatbot

Requirements

You need python 3.6 or 3.7 and pip

How to run

  1. pip install -r requirements.txt
  2. pip install flask
  3. On Mac: FLASK_APP=application.py flask run. On Window: set FLASK_APP=application.py && flask run
  4. Then go to http://localhost:5000/api/train to train data
  5. http://localhost:5000/api/messages?q=Hi to test
  6. You can use MS Bot Framework Emulator to test it as well. Use URL: http://localhost:5000/api/messages to connect if you want to test it locally.

How to deploy it to Azure

Manual steps:

  1. Create Azure account. You will need valid credit card for it.
  2. Create resource group: e.g. "BotGroup"
  3. Create Bot Channels Registration
  4. Get APP_ID and APP_SECRET from Bot Channels' Settings under Microsoft App Id.
  5. Create App Service with python
  6. Use Deployment Center and select your source code from github
  7. Select App Service build service
  8. Add APP_ID and APP_SECRET to Configuration > Application settings > New application setting
  9. Go back to Bot Channels' Settings and update Endpoint URL e.g. https://pythonchatbot.azurewebsites.net/api/messages

Automation steps via Azure CLI:

  1. Install azure-cli
  2. az login
  3. open az_deploy.sh and update gitrepo, webappname and group
gitrepo=https://github.com/huan-mai/pythonchatbot/
webappname=pythonchatbot1
group=BotGroup1
  1. chmod +x ./az_deploy.sh
  2. ./az_deploy.sh

How to integrate bot to Slack

Follow this article to integrate the bot to Slack.

Notes:

Troubleshooting

  1. If you get [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed error when running pip install command, download the pem file from http://curl.haxx.se/ca/cacert.pem, then run the command with --cert parameter. Example: pip --cert /path/to/cacert.pem install linkchecker (Reference: https://stackoverflow.com/questions/25981703/pip-install-fails-with-connection-error-ssl-certificate-verify-failed-certi/26062583)

pythonchatbot's People

Contributors

huan-mai avatar nguyen190887 avatar huanmai-kms avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.