Update README.md
Browse files
README.md
CHANGED
|
@@ -95,4 +95,27 @@ from transformers import pipeline
|
|
| 95 |
|
| 96 |
classifier = pipeline("text-classification", model="ProfessorLeVesseur/bert-base-cased-timeframe-classifier")
|
| 97 |
result = classifier("The meeting will take place tomorrow.")
|
| 98 |
-
print(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
classifier = pipeline("text-classification", model="ProfessorLeVesseur/bert-base-cased-timeframe-classifier")
|
| 97 |
result = classifier("The meeting will take place tomorrow.")
|
| 98 |
+
print(result)
|
| 99 |
+
|
| 100 |
+
## How to Use 🚀
|
| 101 |
+
|
| 102 |
+
This model can be used for text classification tasks, either for individual text inputs or for batch processing via a DataFrame. Below are examples of both use cases.
|
| 103 |
+
|
| 104 |
+
### Classifying Input Text
|
| 105 |
+
|
| 106 |
+
To classify a single piece of text and retrieve the predicted label along with the confidence score, you can use the following code:
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
from transformers import pipeline # Import the pipeline function from the transformers library
|
| 110 |
+
|
| 111 |
+
# Initialize a text classification pipeline using the specified model
|
| 112 |
+
classifier = pipeline(
|
| 113 |
+
"text-classification", # Specify the task type as text classification
|
| 114 |
+
model="ProfessorLeVesseur/bert-base-cased-timeframe-classifier" # Specify the model to use from the Hugging Face Model Hub
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
# Use the classifier to predict the label for the input text
|
| 118 |
+
result = classifier("MTSS.ai is the future of education, call it education².") # Classify the input text and store the result
|
| 119 |
+
|
| 120 |
+
# Print the classification result, which includes the predicted label and the confidence score
|
| 121 |
+
print(result) # Output the result to the console
|