File size: 1,726 Bytes
e089b92
 
 
 
 
 
 
 
 
 
 
 
 
cc5f6e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Flan T5 Token Ner
emoji: πŸ“š
colorFrom: red
colorTo: gray
sdk: gradio
sdk_version: 5.23.3
app_file: app.py
pinned: false
license: mit
short_description: Classifies each token in the input text as LOC, ORG, PER, or
---

# Flan-T5 Token Classifier (NER Demo)

This Huggingface Space is a Gradio demo for the model [`pepegiallo/flan-t5-base_ner`](https://huggingface.co/pepegiallo/flan-t5-base_ner). It performs **token-level Named Entity Recognition (NER)** using a Flan-T5 encoder-based architecture.

---

## πŸ” What does this demo do?

You can enter any sentence, and the app will:

1. Split the sentence into tokens (words and punctuation)
2. For each token:
    - Mark it with `<TSTART>` and `<TEND>` in the context of the sentence
    - Send it through the model with the prompt: `classify token in: <wrapped sentence>`
3. Predict one of the following labels for each token:
    - `PER` β€” Person
    - `ORG` β€” Organization
    - `LOC` β€” Location
    - `O` β€” Not an entity

---

## 🧠 Example

Input:
```
Max Mustermann works at Microsoft and lives in Berlin.
```

Output:
```
Max         -> PER
Mustermann  -> PER
Microsoft   -> ORG
Berlin      -> LOC
```

---

## πŸ“¦ Model Details

- **Base model:** `google/flan-t5-base` (encoder only)
- **Fine-tuned on:** WikiANN, open-pii-masking-500k, and custom samples
- **Prompt-based classification** per token
- **Architecture:** T5 encoder + classification head

---

## πŸš€ Try it out!

Type any sentence in English, German, French, Italian or Spanish, and the model will tag names, organizations, and locations.

For more details, check the full model card:
πŸ‘‰ [`pepegiallo/flan-t5-base_ner`](https://huggingface.co/pepegiallo/flan-t5-base_ner)