Code Monkey home page Code Monkey logo

chatbot-deployment's Introduction

Chatbot Deployment with Flask and JavaScript

In this tutorial we deploy the chatbot I created in this tutorial with Flask and JavaScript.

This gives 2 deployment options:

  • Deploy within Flask app with jinja2 template
  • Serve only the Flask prediction API. The used html and javascript files can be included in any Frontend application (with only a slight modification) and can run completely separate from the Flask App then.

Initial Setup:

This repo currently contains the starter files.

Clone repo and create a virtual environment

$ git clone https://github.com/python-engineer/chatbot-deployment.git
$ cd chatbot-deployment
$ python3 -m venv venv
$ . venv/bin/activate

Install dependencies

$ (venv) pip install Flask torch torchvision nltk

Install nltk package

$ (venv) python
>>> import nltk
>>> nltk.download('punkt')

Modify intents.json with different intents and responses for your Chatbot

Run

$ (venv) python train.py

This will dump data.pth file. And then run the following command to test it in the console.

$ (venv) python chat.py

Now for deployment follow my tutorial to implement app.py and app.js.

Watch the Tutorial

Alt text
https://youtu.be/a37BL0stIuM

Note

In the video we implement the first approach using jinja2 templates within our Flask app. Only slight modifications are needed to run the frontend separately. I put the final frontend code for a standalone frontend application in the standalone-frontend folder.

Credits:

This repo was used for the frontend code: https://github.com/hitchcliff/front-end-chatjs

chatbot-deployment's People

Contributors

patrickloeber 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.