File size: 725 Bytes
9216764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from transformers import pipeline

# Load the text classification pipeline for sentiment analysis
fake_news_detector = pipeline("text-classification", model="facebook/bart-large-mnli")

# Streamlit app
st.title("Fake News Detector")

# Input text box for user-provided news article
news_article = st.text_area("Enter the news article:", "")

# Check fake news button
if st.button("Check Fake News"):
    if news_article:
        # Perform fake news detection
        result = fake_news_detector(news_article)[0]

        # Display result
        st.subheader("Result:")
        st.write(f"Label: {result['label']}, Confidence: {result['score']:.2f}")
    else:
        st.warning("Please enter a news article for analysis.")