| # test_model.py | |
| from transformers import pipeline | |
| def test_sentiment(): | |
| # Load the model from Hugging Face Hub | |
| # Replace with your model path | |
| classifier = pipeline( | |
| "sentiment-analysis", | |
| model="shaheerawan3/Vibescribe" | |
| ) | |
| # Test texts | |
| texts = [ | |
| "This movie was amazing! I loved every minute of it.", | |
| "What a terrible waste of time. I hated it.", | |
| "It was okay, not great but not bad either." | |
| ] | |
| # Make predictions | |
| for text in texts: | |
| result = classifier(text)[0] | |
| print(f"\nText: {text}") | |
| print(f"Sentiment: {result['label']}") | |
| print(f"Confidence: {result['score']:.4f}") | |
| if __name__ == "__main__": | |
| test_sentiment() |