Get Appointment

Chatbot with Intent Recognition

FastAPI Chatbot with Intent Recognition — Smart, E

W A lightweight chatbot built with FastAPI, Scikit-learn, and Jinja2 that uses TF-IDF and Logistic Regression for intent recognition. It features a REST API, auto model retraining when intents are updated, and a simple web-based UI for interactive conversations.

Category
Web App
Source Code
View
Published
Aug. 14, 2025

Project Summery

This is a simple chatbot built with FastAPIScikit-learn, and Jinja2, which uses machine learning to recognize user intent and respond accordingly.


🚀 Features

  • Intent recognition using TF-IDF + Logistic Regression
  • REST API with FastAPI
  • Auto model retraining when intents change
  • Simple web-based UI (HTML + JS)
  • Easily extensible for more intents

🧠 Example Intents

intents.json example:

{
  "intents": [
    {
      "tag": "greeting",
      "patterns": ["Hi", "Hello", "Hey"],
      "responses": ["Hello!", "Hi there!"]
    },
    {
      "tag": "goodbye",
      "patterns": ["Bye", "Goodbye", "See you"],
      "responses": ["Goodbye!", "Take care!"]
    }
  ]
}

📦 Installation

Clone the project:

git clone https://github.com/sujit-codezen/chatbot_with_intent.git
cd chatbot-intent

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

⚙️ Train the Model

python model.py

▶️ Run the Server

uvicorn main:app --reload

Output

Server Run

Server Run

 

Web Output

Output

Share