CoolFace
Modelpublic

Sangam530/fake-news-detection-lstm

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
Model Card

Fake News Detection LSTM Model

This repository contains a deep learning model trained to classify news articles as Fake or Real using an LSTM (Long Short-Term Memory) neural network.


Files

  • —lstm_model.h5 Trained Keras LSTM model for fake news classification.
  • —tokenizer.pkl Tokenizer used to preprocess the text data during training.
  • —label_encoder.pkl Label encoder to transform class labels to numeric form and back.

Usage

You can load the model and related files in Python using the Hugging Face Hub as follows:

python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model
import pickle

repo_id = "your-username/fake-news-detection-lstm"

# Download files
model_path = hf_hub_download(repo_id=repo_id, filename="lstm_model.h5")
tokenizer_path = hf_hub_download(repo_id=repo_id, filename="tokenizer.pkl")
label_path = hf_hub_download(repo_id=repo_id, filename="label_encoder.pkl")

# Load model and tokenizer
model = load_model(model_path)
with open(tokenizer_path, "rb") as f:
    tokenizer = pickle.load(f)
with open(label_path, "rb") as f:
    label_encoder = pickle.load(f)