File size: 3,906 Bytes
87ad0e7 11576c7 87ad0e7 11576c7 87ad0e7 d657608 7b5e5f7 d657608 7b5e5f7 d657608 7b5e5f7 d657608 982a8fd 11576c7 982a8fd 11576c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
---
title: Intent Classifier Chatbot
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
app_port: 7860
license: apache-2.0
short_description: Intent Detection API using BERT and Flask
---
# π€ Bert Intent Chatbot (Encoder-Only)
**Intent Detection API using BERT and Flask**
This project uses a fine-tuned BERT model that is an encoder only model without a decoder used to detect user intent from text inputs (e.g., chatbot queries). It provides a lightweight Flask API to classify input sentences into predefined intent categories.
---
## π§ Features
- β
Pretrained BERT fine-tuned on [CLINC150](https://huggingface.co/datasets/clinc_oos)
- π§ Real-time intent classification from natural text
- π REST API using Flask
- π€ Easy to integrate with chatbots, voice assistants, or NLP systems
---
## π Dataset: CLINC150
The project uses the **CLINC150 dataset**, a benchmark dataset for intent classification in task-oriented dialogue systems.
### π§Ύ Overview
- **Total intents**: 150 unique user intents
- **Domains**: 10 real-world domains (e.g., banking, travel, weather, small talk)
- **Examples**: ~22,500 utterances
- **Language**: English
- **Out-of-scope (OOS)**: Includes OOS examples to test robustness
### π Dataset Splits
| Split | Examples |
|-------------|----------|
| Train | 7,000 |
| Validation | 3,000 |
| Test | 5,500 |
### π¦ Source
- Official repo: [clinc/oos-eval](https://github.com/clinc/oos-eval)
- Hugging Face: [`clinc_oos`](https://huggingface.co/datasets/clinc_oos)
---
## π Example
### Request
```bash
{
"text": "I want to book a flight"
}
```
### Response
```bash
{
"intent": "book_flight"
}
```
---
# Intent Classifier Chatbot
A sophisticated intent classification system built with BERT and FastAPI that can predict user intents from natural language text.
## Features
- **Advanced NLP**: Uses BERT-based transformer model for accurate intent classification
- **150+ Intent Classes**: Trained on the CLINC150 dataset with comprehensive intent coverage
- **Real-time Prediction**: FastAPI backend for fast inference
- **Clean UI**: Simple and intuitive web interface
- **Production Ready**: Dockerized for easy deployment
## How to Use
1. Enter your message in the text area
2. Click "Predict Intent"
3. See the AI's prediction of your intent
Try examples like:
- "Set an alarm for 7am" β Alarm
- "Transfer money to John" β Transfer
- "What's the weather like?" β Weather
- "Book a flight to Paris" β Book Flight
## Model Details
- **Architecture**: BERT for Sequence Classification
- **Dataset**: CLINC150 (151 intent classes including out-of-scope)
- **Accuracy**: High performance on intent classification tasks
- **Preprocessing**: Advanced tokenization and text normalization
## Tech Stack
- **Backend**: FastAPI, PyTorch, Transformers
- **Frontend**: HTML, CSS, JavaScript
- **Model**: BERT-base fine-tuned on CLINC150
- **Deployment**: Docker, Hugging Face Spaces
## Author
**Saher Muhamed**
- GitHub: [@sahermuhamed1](https://github.com/sahermuhamed1)
- Email: sahermuhamed176@gmail.com
## π€ Hugging Face Spaces Configuration
To deploy this project on [Hugging Face Spaces](https://huggingface.co/spaces), you can use a `README.md` and a `config.json` file to configure your Space for inference.
Check out the configuration reference at:
https://huggingface.co/docs/hub/spaces-config-reference
Example `config.json` for inference API:
```json
{
"hf_space_type": "inference",
"python_version": "3.10",
"sdk": "gradio",
"entrypoint": "app.py"
}
```
- Make sure your `requirements.txt` lists all dependencies.
- The `entrypoint` should point to your main app file (e.g., `app.py` or `main.py`).
- For more details and advanced configuration, see the [Spaces config reference](https://huggingface.co/docs/hub/spaces-config-reference). |