Update README.md
Browse files
README.md
CHANGED
|
@@ -76,30 +76,25 @@ Users (both direct and downstream) should be made aware of the risks, biases and
|
|
| 76 |
|
| 77 |
## How to Get Started with the Model
|
| 78 |
|
| 79 |
-
|
| 80 |
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 81 |
from transformers import pipeline
|
| 82 |
|
| 83 |
-
# Load pre-trained model and tokenizer
|
| 84 |
model_name = "your-model-name" # Replace with your model name
|
| 85 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 86 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 87 |
|
| 88 |
-
# Create a NER pipeline
|
| 89 |
ner_pipeline = pipeline("ner", model=model, tokenizer=tokenizer)
|
| 90 |
|
| 91 |
-
# Sample text
|
| 92 |
text = "Barack Obama was born on August 4, 1961 in Honolulu, Hawaii."
|
| 93 |
|
| 94 |
-
# Perform NER
|
| 95 |
entities = ner_pipeline(text)
|
| 96 |
|
| 97 |
-
# Print detected entities
|
| 98 |
for entity in entities:
|
| 99 |
print(f"Entity: {entity['word']}, Type: {entity['entity']}, Score: {entity['score']:.4f}")
|
| 100 |
|
| 101 |
|
| 102 |
-
|
| 103 |
|
| 104 |
## Training Details
|
| 105 |
|
|
|
|
| 76 |
|
| 77 |
## How to Get Started with the Model
|
| 78 |
|
| 79 |
+
```python
|
| 80 |
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 81 |
from transformers import pipeline
|
| 82 |
|
|
|
|
| 83 |
model_name = "your-model-name" # Replace with your model name
|
| 84 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 85 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 86 |
|
|
|
|
| 87 |
ner_pipeline = pipeline("ner", model=model, tokenizer=tokenizer)
|
| 88 |
|
|
|
|
| 89 |
text = "Barack Obama was born on August 4, 1961 in Honolulu, Hawaii."
|
| 90 |
|
|
|
|
| 91 |
entities = ner_pipeline(text)
|
| 92 |
|
|
|
|
| 93 |
for entity in entities:
|
| 94 |
print(f"Entity: {entity['word']}, Type: {entity['entity']}, Score: {entity['score']:.4f}")
|
| 95 |
|
| 96 |
|
| 97 |
+
```
|
| 98 |
|
| 99 |
## Training Details
|
| 100 |
|