ragkasi commited on
Commit
16904b2
·
verified ·
1 Parent(s): 0ac6a38

Delete app/app.py

Browse files
Files changed (1) hide show
  1. app/app.py +0 -36
app/app.py DELETED
@@ -1,36 +0,0 @@
1
- import streamlit as st
2
- from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
3
-
4
- # Set page config
5
- st.set_page_config(page_title="Fake News Detector", page_icon="📰")
6
-
7
- # Hugging Face model path (change this to your actual repo ID)
8
- MODEL_DIR = "ragkasi/bert-fake-news"
9
-
10
- @st.cache_resource
11
- def load_pipeline():
12
- tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR)
13
- model = AutoModelForSequenceClassification.from_pretrained(MODEL_DIR)
14
- return pipeline("text-classification", model=model, tokenizer=tokenizer)
15
-
16
- classifier = load_pipeline()
17
-
18
- # UI
19
- st.title("📰 Fake News Detector")
20
- st.markdown("Enter a news **headline** or **statement**, and this app will predict if it's **real** or **fake**.")
21
-
22
- news_input = st.text_area("✏️ News Text", height=150)
23
-
24
- if st.button("🔍 Check News"):
25
- if news_input.strip():
26
- result = classifier(news_input)[0]
27
- label = result["label"]
28
- score = result["score"]
29
-
30
- # Adjust label display
31
- if label == "LABEL_1":
32
- st.error(f"🚨 Likely **Fake News** (Confidence: `{score:.2f}`)")
33
- else:
34
- st.success(f"✅ Likely **Real News** (Confidence: `{score:.2f}`)")
35
- else:
36
- st.warning("⚠️ Please enter a news statement.")