Coder Social home page Coder Social logo

chatbotdemo's Introduction

ChatBot Demo

An example that showcases the benefit of running AI inside Redis.

This repository contains the backend web app built with Flask, front end built with Angular (compiled to native JS) and the model files required for the chatbot to work. Follow below steps to bring the chatbot up.

Architecture

When the flask application starts, it will set an initial hidden tensor. This hidden tensor represents the intermediate state of the conversation. On each new message received, an sentence tensor and the hidden tensor are passed through the model, which in turn produces an output and overrides the hidden tensor with the new intermediate state.

ChatBot Flow

(Note this diagram is simplified, the full flow can be followed here)

Requirements

  • Docker
  • Docker-compose

Running the demo

$ git clone [email protected]:RedisAI/ChatBotDemo.git
$ cd ChatBotDemo
$ docker-compose up

API

Try out the API (we have only one API endpoint -> /chat which accepts message as the JSON key with your message as value) using curl as shown below.

curl http://localhost:5000/chat -H "Content-Type: application/json" -d '{"message": "I am crazy"}'

CLI

Open a second terminal and inspect the keys:

$ redis-cli
127.0.0.1:6379> keys *
1) "d_output"
2) "decoder"
3) "hidden"
4) "encoder"
5) "e_output"
6) "d_input"
7) "sentence"
127.0.0.1:6379> type hidden
AI_TENSOR

UI

Open a browser and point it to http://localhost:5000.

RedisAI chatbot demo with pytorch

chatbotdemo's People

Contributors

boat-builder avatar chayim avatar dvirdukhan avatar gkorland avatar k-jo avatar rafie avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

chatbotdemo's Issues

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.