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:

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)
Downloads last month
0
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support