added pipeline usage example
Browse files
README.md
CHANGED
|
@@ -75,3 +75,18 @@ result2 = predict_sentiment("I really disliked this movie, it was terrible.")
|
|
| 75 |
|
| 76 |
print(f"Sentiment: {result1['sentiment']}, Confidence: {result1['confidence']}%")
|
| 77 |
print(f"Sentiment: {result2['sentiment']}, Confidence: {result2['confidence']}%")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
print(f"Sentiment: {result1['sentiment']}, Confidence: {result1['confidence']}%")
|
| 77 |
print(f"Sentiment: {result2['sentiment']}, Confidence: {result2['confidence']}%")
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
from transformers import pipeline
|
| 82 |
+
|
| 83 |
+
pipe = pipeline("text-classification", model="philipobiorah/bert-imdb-model")
|
| 84 |
+
|
| 85 |
+
text_to_classify = "This movie was fantastic! I loved every minute of it."
|
| 86 |
+
result = pipe(text_to_classify)
|
| 87 |
+
print(result)
|
| 88 |
+
|
| 89 |
+
text_to_classify_2 = "The acting was terrible and the plot made no sense."
|
| 90 |
+
result_2 = pipe(text_to_classify_2)
|
| 91 |
+
print(result_2)
|
| 92 |
+
|