| from transformers import pipeline | |
| def analyze_sentiment(text): | |
| """ | |
| Analyzes the sentiment of a given text using a pretrained model. | |
| """ | |
| sentiment_pipeline = pipeline("sentiment-analysis") | |
| result = sentiment_pipeline(text) | |
| return result | |
| if __name__ == '__main__': | |
| text_to_analyze = "I love the new AI model! It's so innovative and powerful." | |
| sentiment = analyze_sentiment(text_to_analyze) | |
| print("Sentiment analysis result:", sentiment) | |