|
|
---
|
|
|
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) |