import streamlit as st from transformers import pipeline st.title("Stock News Sentiment Analysis") st.write("Enter some news text to analyze its sentiment:") text = st.text_area("Text Input") if text: try: # Load the sentiment analysis pipeline sentiment_pipeline = pipeline("sentiment-analysis") result = sentiment_pipeline(text)[0] st.write(f"Sentiment: {result['label']}, Score: {result['score']:.2f}") except Exception as e: st.error(f"Error: {e}")