project_news / app.py
Aytaj's picture
Create app.py
9216764
raw
history blame
No virus
725 Bytes
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.")