Commit
·
d8669dc
1
Parent(s):
03f258f
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,7 +7,7 @@ tags:
|
|
| 7 |
pipeline_tag: text-classification
|
| 8 |
---
|
| 9 |
|
| 10 |
-
#
|
| 11 |
|
| 12 |
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification. The model has been trained using an efficient few-shot learning technique that involves:
|
| 13 |
|
|
@@ -27,10 +27,39 @@ You can then run inference as follows:
|
|
| 27 |
```python
|
| 28 |
from setfit import SetFitModel
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Run inference
|
| 33 |
-
preds = model(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
```
|
| 35 |
|
| 36 |
## BibTeX entry and citation info
|
|
|
|
| 7 |
pipeline_tag: text-classification
|
| 8 |
---
|
| 9 |
|
| 10 |
+
#mhammadkhan/negation-categories-classifier
|
| 11 |
|
| 12 |
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification. The model has been trained using an efficient few-shot learning technique that involves:
|
| 13 |
|
|
|
|
| 27 |
```python
|
| 28 |
from setfit import SetFitModel
|
| 29 |
|
| 30 |
+
model = SetFitModel.from_pretrained("mhammadkhan/negation-categories-classifier")
|
| 31 |
+
|
| 32 |
+
# Define category labels
|
| 33 |
+
labels = {0: "dairy-free", 1: "gluten-free", 2: "nut-free", 3: "soy-free", 4: "vegan"}
|
| 34 |
+
|
| 35 |
+
# Define input recipes
|
| 36 |
+
recipes = [
|
| 37 |
+
{"text": "Tacos de Coliflor Vegana", "ingredients":["cauliflower", "taco seasoning", "corn tortillas", "avocado", "salsa", "cilantro", "lime wedges"]},
|
| 38 |
+
{"text": "Pulpo a la Gallega Sin Gluten", "ingredients":["octopus", "potatoes", "paprika", "olive oil", "salt"]},
|
| 39 |
+
{"text": "Creamy Tomato Soup", "ingredients":["tomatoes", "vegetable broth", "onion", "garlic", "coconut milk"]},
|
| 40 |
+
{"text": "Chicken Alfredo Pasta", "ingredients":["chicken breast", "pasta", "broccoli", "mushrooms", "cashew cream"]},
|
| 41 |
+
{"text": "Cheesy Broccoli Casserole", "ingredients":["broccoli", "almond milk", "nutritional yeast", "gluten-free breadcrumbs"]},
|
| 42 |
+
{"text": "Gluten-Free Pizza", "ingredients":["gluten-free pizza crust", "tomato sauce", "mozzarella cheese", "mushrooms", "bell peppers"]},
|
| 43 |
+
{"text": "Quinoa Salad with Roasted Vegetables", "ingredients":["quinoa", "roasted sweet potato", "roasted Brussels sprouts", "dried cranberries", "almonds"]},
|
| 44 |
+
{"text": "Gluten-Free Chocolate Chip Cookies", "ingredients":["gluten-free flour", "brown sugar", "baking soda", "chocolate chips", "coconut oil"]},
|
| 45 |
+
{"text": "Chicken Satay Skewers", "ingredients":["chicken breast", "coconut milk", "peanut butter", "soy sauce", "lime juice"]},
|
| 46 |
+
{"text": "Pesto Pasta Salad", "ingredients":["pasta", "basil", "parmesan cheese", "pine nuts", "olive oil"]},
|
| 47 |
+
{"text": "Maple-Glazed Salmon", "ingredients":["salmon", "maple syrup", "pecans", "butter", "garlic"]},
|
| 48 |
+
{"text": "Beef and Broccoli Stir-Fry", "ingredients":["beef sirloin", "broccoli", "carrots", "garlic", "ginger", "cornstarch"]},
|
| 49 |
+
{"text": "Creamy Mushroom Soup", "ingredients":["mushrooms", "vegetable broth", "onion", "garlic", "cashew cream"]},
|
| 50 |
+
{"text": "Lemon-Garlic Roasted Chicken", "ingredients":["chicken thighs", "lemon juice", "garlic", "olive oil", "rosemary"]},
|
| 51 |
+
{"text": "Vegan Lasagna", "ingredients":["lasagna noodles", "tofu ricotta", "marinara sauce", "spinach", "mushrooms"]},
|
| 52 |
+
{"text": "Chickpea Curry", "ingredients":["chickpeas", "coconut milk", "tomatoes", "spinach", "curry powder"]},
|
| 53 |
+
{"text": "Vegan Banana Bread", "ingredients":["flour", "bananas", "sugar", "baking powder", "almond milk"]},
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
# Run inference
|
| 57 |
+
preds = model(recipes)
|
| 58 |
+
print(preds)
|
| 59 |
+
# Map integer predictions to category labels
|
| 60 |
+
preds = [labels[pred.item()] for pred in preds]
|
| 61 |
+
|
| 62 |
+
print(preds)
|
| 63 |
```
|
| 64 |
|
| 65 |
## BibTeX entry and citation info
|