Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from news_pipeline import NewsPipeline | |
| CATEGORY_EMOJIS = { | |
| "Automobile": "π", | |
| "Entertainment": "πΏ", | |
| "Politics": "βοΈ", | |
| "Science": "π§ͺ", | |
| "Sports": "π", | |
| "Technology": "π»", | |
| "World": "π", | |
| } | |
| FAKE_EMOJIS = {"Fake": "π»", "Real": "π"} | |
| CLICKBAIT_EMOJIS = {"Clickbait": "π£", "Normal": "β "} | |
| def app(): | |
| news_pipe = NewsPipeline() | |
| st.title("π° News Analyzer") | |
| headline = st.text_input("Article headline:") | |
| content = st.text_area("Article content:") | |
| button = st.button("Analyze") | |
| if button: | |
| with st.spinner("Analyzing article..."): | |
| prediction = news_pipe(headline, content) | |
| st.success("Article successfully analyzed!") | |
| st.markdown( | |
| f"{CATEGORY_EMOJIS[prediction['category']]} **Category**: {prediction['category']}" | |
| ) | |
| st.markdown( | |
| f"{FAKE_EMOJIS[prediction['fake']]} **Fake**: {'Yes' if prediction['fake'] == 'Fake' else 'No'}" | |
| ) | |
| st.markdown( | |
| f"{CLICKBAIT_EMOJIS[prediction['clickbait']]} **Clickbait**: {'Yes' if prediction['clickbait'] == 'Clickbait' else 'No'}" | |
| ) | |
| if __name__ == "__main__": | |
| app() | |