is-shaun / simple-ml-python-chatbot

This is a simple python chatbot which uses json file to store the data. It uses TF-IDF (Term Frequency-Inverse Document Frequency) vectorizer and a Multinomial Naive Bayes classifier to classify the user input and give the response.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Python Chatbot

This is a simple python chatbot which uses json file to store the data. It uses TF-IDF (Term Frequency-Inverse Document Frequency) vectorizer and a Multinomial Naive Bayes classifier to classify the user input and give the response.

This project is under development and soon will be supported to web with multi modal support.

Table of Contents

Demo

Demo Video

demo.mp4

Screenshots

Screenshot 1

Installation

Use the package manager pip to install the required packages.

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python train.py
python app.py

or

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
python3 train.py
python3 app.py

Usage

Arguments:

  • --port or -p: Change the port number (default: 5000)
  • --server or -s: Change the server (default: Server is True, no UI)
python train.py
python app.py

or

python3 train.py
python3 app.py

Example:

python app.py --port 5001 --server 1 # Run the server on port 5001 and hide the UI 

or

python app.py --port 5001 --server - # Run the server on port 5001 and show the UI

Example Usage

A very basic implementation of API using Python requests library.

import requests

url = "http://127.0.0.1:5000/api/chat"

if __name__ == "__main__":
    while True:
        input_data = str(input("Enter your question: "))
        data = {"question": input_data}
        response = requests.post(url, json=data)
        print("Bot:", response.json()["response"])

Features

  • Text support
  • Custom response support
  • YouTube Search support
  • Google Search support
  • Wikipedia Search support
  • Google News support
  • Google Maps support
  • API support
  • YouTube Video support
  • Conversation continuance support
  • Image search support
  • Translation support
  • Image support
  • Audio support
  • Video support
  • Muliple language support
  • Markdown support
  • Speech to text support
  • Text to speech support
  • Customizable

Authors

About

This is a simple python chatbot which uses json file to store the data. It uses TF-IDF (Term Frequency-Inverse Document Frequency) vectorizer and a Multinomial Naive Bayes classifier to classify the user input and give the response.

License:MIT License


Languages

Language:Python 56.5%Language:JavaScript 23.4%Language:CSS 15.9%Language:HTML 4.2%