Infinity-1995's picture
Update app.py
c855119 verified
raw
history blame
1.15 kB
import streamlit as st
from transformers import pipeline
# App title
st.set_page_config(page_title="Fake Job Detector", page_icon="πŸ•΅οΈβ€β™‚οΈ")
st.title("Fake Job / Lie Detector")
st.markdown("Enter a job description and check if it seems suspicious!")
# Load small NLI model for zero-shot classification (CPU-friendly)
@st.cache_resource
def load_model():
return pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
classifier = load_model()
# Input from user
job_description = st.text_area("Enter the job description:")
# Label options
labels = ["Legitimate", "Suspicious", "Fake", "Scam"]
# Button to check
if st.button("Check Job"):
if not job_description.strip():
st.warning("Please enter a job description!")
else:
# Run zero-shot classification
results = classifier(job_description, candidate_labels=labels)
st.subheader("Prediction:")
# Show top label and scores
top_label = results["labels"][0]
score = results["scores"][0]
st.success(f"Most likely: **{top_label}** ({score*100:.2f}%)")
st.write("Full results:", results)