Spaces:
Sleeping
Sleeping
Update app.py
Browse files11234556789107811121314151617181019202122232425131426272816171819202122293031323334353637383940414243# app.pyimport 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 Posting Detector")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.")
# Use a small model that fits in Hugging Face Space memoryclassifier = pipeline("zero-shot-classification", model="Groq/compound-mini")# --- Load zero-shot classification model ---@st.cache_resourcedef load_model(): return pipeline( "zero-shot-classification", model="typeform/distilbert-base-uncased-mnli" )
job_description = st.text_area("Enter the job description:")classifier = load_model()
# --- Text input ---job_description = st.text_area("Enter the job description here:")
# --- Button action ---if st.button("Check Job"): if job_description.strip() == "": st.warning("Please enter a job description.") if not job_description.strip(): st.warning("⚠️ Please enter a job description first!") else: labels = ["Legit", "Fake"] result = classifier(job_description, candidate_labels=labels) predicted_label = result['labels'][0] confidence = result['scores'][0] st.write(f"Prediction: **{predicted_label}**") st.write(f"Confidence: {confidence:.2f}") 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.")app.py+35-14