File size: 1,828 Bytes
3ecaab7 a677f92 3ecaab7 a677f92 |
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 45 46 47 48 49 50 51 52 53 54 |
---
license: mit
language: en
datasets:
- amananandrai/clickbait-dataset
metrics:
- accuracy
tags:
- sklearn
- text-classification
- clickbait
widget:
- text: "You Won't Believe What Happens Next!"
example_title: "Clickbait Example"
- text: "Scientists Discover New Planet in Solar System"
example_title: "Non-Clickbait Example"
---
# Clickbait Detection Model (Logistic Regression)
ูุฐุง ูู
ูุฐุฌ ุชุนูู
ุขูุฉ (Scikit-learn Pipeline) ุชู
ุชุฏุฑูุจู ูุชุตููู ุนูุงููู ุงูุฃุฎุจุงุฑ (Headlines) ุฅูู "Clickbait" (ุนููุงู ู
ุซูุฑ) ุฃู "Not Clickbait" (ุนููุงู ุนุงุฏู).
## ๐ ููู ุชุณุชุฎุฏู
ุงููู
ูุฐุฌ
ุชู
ุญูุธ ุงููู
ูุฐุฌ ูู `Pipeline` ูุงู
ู ู
ู `sklearn`ุ ููู ูุชุถู
ู `TfidfVectorizer` ู `LogisticRegression`. ูุฐุง ูุนูู ุฃูู ูุชุนุงู
ู ู
ุน ุงููุต ู
ุจุงุดุฑุฉ.
```python
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) |