File size: 1,354 Bytes
ff9adfe
8850ba6
ff9adfe
0593b67
 
 
 
 
 
ff9adfe
0593b67
 
 
 
 
 
 
ff9adfe
0593b67
ff9adfe
0593b67
 
 
 
8850ba6
0593b67
 
ff9adfe
0593b67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import streamlit as st
from transformers import pipeline

# --- App title and description ---
st.set_page_config(page_title="Fake Job / Lie Detector", layout="centered")
st.title("πŸ” Fake Job / Lie Detector")
st.write(
    "Enter a job description below and the AI will predict if it's likely genuine or fake."
)

# --- Load zero-shot classification model ---
@st.cache_resource
def load_model():
    return pipeline(
        "zero-shot-classification",
        model="typeform/distilbert-base-uncased-mnli"
    )

classifier = load_model()

# --- Text input ---
job_description = st.text_area("Enter the job description here:")

# --- Button action ---
if st.button("Check Job"):
    if not job_description.strip():
        st.warning("⚠️ Please enter a job description first!")
    else:
        candidate_labels = ["genuine", "fake"]
        result = classifier(job_description, candidate_labels)

        label = result['labels'][0]
        confidence = round(result['scores'][0]*100, 2)

        # --- Display results with color ---
        if label == "genuine":
            st.success(f"βœ… Prediction: {label.upper()} ({confidence}%)")
        else:
            st.error(f"❌ Prediction: {label.upper()} ({confidence}%)")

# --- Footer ---
st.markdown("---")
st.markdown("Built with ❀️ using Hugging Face Transformers and Streamlit.")