Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,4 +11,58 @@ license: mit
|
|
| 11 |
short_description: Classifies each token in the input text as LOC, ORG, PER, or
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
short_description: Classifies each token in the input text as LOC, ORG, PER, or
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Flan-T5 Token Classifier (NER Demo)
|
| 15 |
+
|
| 16 |
+
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.
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## π What does this demo do?
|
| 21 |
+
|
| 22 |
+
You can enter any sentence, and the app will:
|
| 23 |
+
|
| 24 |
+
1. Split the sentence into tokens (words and punctuation)
|
| 25 |
+
2. For each token:
|
| 26 |
+
- Mark it with `<TSTART>` and `<TEND>` in the context of the sentence
|
| 27 |
+
- Send it through the model with the prompt: `classify token in: <wrapped sentence>`
|
| 28 |
+
3. Predict one of the following labels for each token:
|
| 29 |
+
- `PER` β Person
|
| 30 |
+
- `ORG` β Organization
|
| 31 |
+
- `LOC` β Location
|
| 32 |
+
- `O` β Not an entity
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## π§ Example
|
| 37 |
+
|
| 38 |
+
Input:
|
| 39 |
+
```
|
| 40 |
+
Max Mustermann works at Microsoft and lives in Berlin.
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
Output:
|
| 44 |
+
```
|
| 45 |
+
Max -> PER
|
| 46 |
+
Mustermann -> PER
|
| 47 |
+
Microsoft -> ORG
|
| 48 |
+
Berlin -> LOC
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## π¦ Model Details
|
| 54 |
+
|
| 55 |
+
- **Base model:** `google/flan-t5-base` (encoder only)
|
| 56 |
+
- **Fine-tuned on:** WikiANN, open-pii-masking-500k, and custom samples
|
| 57 |
+
- **Prompt-based classification** per token
|
| 58 |
+
- **Architecture:** T5 encoder + classification head
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## π Try it out!
|
| 63 |
+
|
| 64 |
+
Type any sentence in English, German, French, Italian or Spanish, and the model will tag names, organizations, and locations.
|
| 65 |
+
|
| 66 |
+
For more details, check the full model card:
|
| 67 |
+
π [`pepegiallo/flan-t5-base_ner`](https://huggingface.co/pepegiallo/flan-t5-base_ner)
|
| 68 |
+
|