Views
No views yet
1from transformers import pipeline
2
3ner_pipeline = pipeline(
4 "token-classification",
5 model="neZorinEgor/recipe_ner_model",
6)
7
8test_recipes = [
9 "2 cups flour 1/2 teaspoon salt",
10 "3 tablespoons olive oil 2 cloves garlic minced",
11 "1 pound beef brisket 1 onion chopped",
12]
13
14for t in test_recipes:
15 print("-"*50)
16 print(ner_pipeline(t))1- Loss: 0.2891
2- Accuracy: 0.9102
3- F1: 0.9000
4- Classification Report: precision recall f1-score support
5
6 COMMENT 0.76 0.78 0.77 6934
7 INDEX 0.00 0.00 0.00 2
8 NAME 0.88 0.89 0.88 7773
9 QTY 0.99 0.99 0.99 6416
10 RANGE_END 0.96 0.97 0.97 110
11 UNIT 0.99 0.99 0.99 5428
12
13 micro avg 0.90 0.90 0.90 26663
14 macro avg 0.76 0.77 0.77 26663
15weighted avg 0.90 0.90 0.90 26663