Spaces:
Sleeping
Sleeping
Update app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243import streamlit as stfrom 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_resourcedef 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.")123456789101112131415161718192021222324252627import streamlit as stfrom transformers import pipelinest.title("Fake Job / Lie Detector")st.write("This app classifies a job description as potentially fake or real. ""Runs entirely locally on CPU, no API key needed.")# Use a small, CPU-friendly modelclassifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli", device=-1)job_description = st.text_area("Enter the job description:")if st.button("Check Job"):if not job_description.strip():st.warning("Please enter a job description.")else:# Define the candidate labelslabels = ["real", "fake"]result = classifier(job_description, candidate_labels=labels)top_label = result["labels"][0]score = result["scores"][0]st.write(f"Prediction: **{top_label.upper()}**")st.write(f"Confidence: **{score*100:.2f}%**")
app.py+16-32