Clickbait Detection Model (Logistic Regression)

ู‡ุฐุง ู†ู…ูˆุฐุฌ ุชุนู„ู… ุขู„ุฉ (Scikit-learn Pipeline) ุชู… ุชุฏุฑูŠุจู‡ ู„ุชุตู†ูŠู ุนู†ุงูˆูŠู† ุงู„ุฃุฎุจุงุฑ (Headlines) ุฅู„ู‰ "Clickbait" (ุนู†ูˆุงู† ู…ุซูŠุฑ) ุฃูˆ "Not Clickbait" (ุนู†ูˆุงู† ุนุงุฏูŠ).

๐Ÿš€ ูƒูŠู ุชุณุชุฎุฏู… ุงู„ู†ู…ูˆุฐุฌ

ุชู… ุญูุธ ุงู„ู†ู…ูˆุฐุฌ ูƒู€ Pipeline ูƒุงู…ู„ ู…ู† sklearnุŒ ูˆู‡ูˆ ูŠุชุถู…ู† TfidfVectorizer ูˆ LogisticRegression. ู‡ุฐุง ูŠุนู†ูŠ ุฃู†ู‡ ูŠุชุนุงู…ู„ ู…ุน ุงู„ู†ุต ู…ุจุงุดุฑุฉ.

import joblib

# ู‚ู… ุจุชุญู…ูŠู„ ุงู„ู†ู…ูˆุฐุฌ ู…ู† Hugging Face Hub
# (ุชุฃูƒุฏ ู…ู† ุชุซุจูŠุช huggingface_hub: pip install huggingface_hub)
from huggingface_hub import hf_hub_download

model_path = hf_hub_download(repo_id="[Ma120]/[clickbait-detector]", filename="clickbait_model.pkl")
model = joblib.load(model_path)

# ุงุฎุชุจุฑ ุงู„ู†ู…ูˆุฐุฌ
headlines = [
    "You Won't Believe What Happens Next!",
    "Local Library Announces Summer Reading Program",
    "10 Signs You're a Genius (Number 7 Will Shock You)",
    "Government Passes New Budget Bill"
]

predictions = model.predict(headlines)

# 1 = Clickbait, 0 = Not Clickbait
for headline, pred in zip(headlines, predictions):
    label = "Clickbait" if pred == 1 else "Not Clickbait"
    print(f"[{label}] {headline}")

# ูŠู…ูƒู†ูƒ ุฃูŠุถุงู‹ ุงู„ุญุตูˆู„ ุนู„ู‰ ุงู„ุงุญุชู…ุงู„ุงุช
# probabilities = model.predict_proba(headlines)
# print(probabilities)
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using Ma120/clickbait-detector 1