import streamlit as st from tweet_pipeline import TweetPipeline EMOTION_EMOJIS = {"Anger": "😡", "Joy": "😂", "Optimism": "😉", "Sadness": "😢"} OFFENSIVE_EMOJIS = {"Offensive": "😈", "Non-Offensive": "😇"} SENTIMENT_EMOJIS = {"Negative": "❌", "Neutral": "🤷‍♂️", "Positive": "✅"} tweet_eval = TweetPipeline() st.title("🐦 Tweet Evaluator") input_text = st.text_input("") button = st.button("Evaluate!") if button and input_text != "": with st.spinner("Evaluating tweet..."): prediction = tweet_eval(input_text) st.success("Tweet successfully evaluated!") st.markdown( f"{EMOTION_EMOJIS[prediction['emotion']]} **Emotion:** {prediction['emotion']}" ) st.markdown( f"{OFFENSIVE_EMOJIS[prediction['offensive']]} **Offensive:** {'Yes' if prediction['offensive'] == 'Offensive' else 'No'}" ) st.markdown( f"{SENTIMENT_EMOJIS[prediction['sentiment']]} **Sentiment:** {prediction['sentiment']}" ) elif button and not input_text: st.warning("Please, introduce a tweet to eval.")