safetensors bert text-classification en dataset:SriramRokkam/ner_dataset.csv base_model:google-bert/bert-base-uncased base_model:finetune:google-bert/bert-base-uncased license:apache-2.0 region:us
---
base_model:
- google-bert/bert-base-uncased
datasets:
- SriramRokkam/ner_dataset.csv
language:
- en
license: apache-2.0
pipeline_tag: text-classification
---

---

# BERT Named Entity Recognition (NER) Model

This model performs Named Entity Recognition (NER) using a fine-tuned version of BERT (Bidirectional Encoder Representations from Transformers) based on the `bert-base-cased` model from Google. It identifies entities in a given text, such as people, organizations, and locations. The model has been fine-tuned on a custom NER dataset.

---

## Model Overview

- **Model:** BERT-based NER
- **Base model:** [bert-base-cased](https://huggingface.co/google-bert/bert-base-cased)
- **Language:** English (en)
- **Task:** Text Classification (NER)

---

## Dataset

The dataset used for training is available [here](https://github.com/sriramrokkam/BERT_NER/blob/BITS/ner_dataset.csv).

---

## Metrics

This model has been evaluated on various metrics:

- **Evaluation Loss:** 0.176
- **Precision:** 82.5%
- **Recall:** 77.1%
- **F1 Score:** 79.7%
- **Accuracy:** Reported during evaluation.

---

## Usage

You can use this model in two ways: via direct code execution or by running a Docker container.

### Option 1: Direct Code Execution

To use this model via code, you’ll first need to log in to Hugging Face CLI and enter your access token.

#### Step 1: Install Hugging Face Transformers and CLI

If you haven’t already, install the necessary dependencies:

```bash
pip install transformers huggingface_hub
```

#### Step 2: Login to Hugging Face

Use the following command to log in to your Hugging Face account:

```bash
huggingface-cli login
```

You'll be prompted to enter your Hugging Face access token. You can find your token [here](https://huggingface.co/settings/tokens).

#### Step 3: Use the Model

Once logged in, you can use the following Python code to load and run the model for NER tasks:

```python
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

# Load the model and tokenizer
model_name = "sriramrokkam/bert_ner"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

# Create a pipeline for NER
nlp = pipeline("ner", model=model, tokenizer=tokenizer)

# Interactive example
input_text = input("Enter a sentence for NER: ")
ner_results = nlp(input_text)

# Display results
for entity in ner_results:
    print(f"Entity: {entity['word']}, Label: {entity['entity']}, Confidence: {entity['score']:.2f}")
```

---

### Option 2: Docker

You can also run this model using Docker for a simple and interactive NER chatbot interface.

#### Prerequisites

Make sure you have Docker installed on your system.

#### Step 1: Pull the Docker Image

Pull the Docker image from Docker Hub:

```bash
docker pull sriramrokkam/ner-chatbot-web
```

[View on Docker Hub](https://hub.docker.com/repository/docker/sriramrokkam/ner-chatbot-web/general)

#### Step 2: Run the Docker Container

Run the container to start the web-based NER chatbot interface:

```bash
docker run -p 8080:8080 --name BERT_NER_Chatbot -it sriramrokkam/ner-chatbot-web
```

#### Step 3: Access the Web Interface

Once the container is running, open your browser and go to:

```
http://localhost:8080
```

This will open a professional chatbot interface where you can enter text, and the model will perform Named Entity Recognition (NER) on the input.

---

## License

This project is licensed under the MIT License.

---

## Contact Information

- **Author:** Sriram Rokkam
- **GitHub:** [BERT_NER GitHub](https://github.com/sriramrokkam/BERT_NER)
- **LinkedIn:** [Sriram Rokkam](https://www.linkedin.com/in/sriramrokkam/)
- **Email:** sriramrokkam@gmail.com
- **Docker Hub:** [Sriram Rokkam](https://hub.docker.com/r/sriramrokkam/ner-chatbot-web)

---