Aytaj commited on
Commit
9216764
1 Parent(s): 3008f5e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ # Load the text classification pipeline for sentiment analysis
4
+ fake_news_detector = pipeline("text-classification", model="facebook/bart-large-mnli")
5
+
6
+ # Streamlit app
7
+ st.title("Fake News Detector")
8
+
9
+ # Input text box for user-provided news article
10
+ news_article = st.text_area("Enter the news article:", "")
11
+
12
+ # Check fake news button
13
+ if st.button("Check Fake News"):
14
+ if news_article:
15
+ # Perform fake news detection
16
+ result = fake_news_detector(news_article)[0]
17
+
18
+ # Display result
19
+ st.subheader("Result:")
20
+ st.write(f"Label: {result['label']}, Confidence: {result['score']:.2f}")
21
+ else:
22
+ st.warning("Please enter a news article for analysis.")