from transformers import pipeline # Load Hugging Face sentiment analysis model sentiment_analyzer = pipeline("sentiment-analysis") def analyze_sentiment(text): """Analyze sentiment of extracted text.""" return sentiment_analyzer(text[:512]) # Limit to 512 characters for model efficiency