Downloads · 30 days
29
8% of all-time downloads
Ravinthiran/Distilsenti-Net-42M
Distilsenti-Net-42M is a text classification model from Ravinthiran. Use it when you need a label for a piece of text. It is set up for keras. The card lists the license as apache-2.0.
- Embedding Layer: Converts input text into dense vectors. - CNN Layers: Extracts features from text sequences. - RNN, LSTM, and GRU Layers: Capture temporal dependencies in text. - Dense Layers: Classify text into se…
Downloads · 30 days
29
8% of all-time downloads
All-time downloads
380
Public
Repo size
566 MB
Likes
0
Public
Click a slice to open those files.
.keras225 MB · 56%
From the Hugging Face model README
You can use this model for sentiment analysis on text data. Here's a sample code to load and use the model:
from tensorflow.keras.models import load_model
import pickle
import numpy as np
from tensorflow.keras.preprocessing.sequence import pad_sequences
# Load the model
model = load_model('path_to_model/hybrid_model.h5')
# Load the tokenizer
with open('path_to_tokenizer/tokenizer.pkl', 'rb') as f:
tokenizer = pickle.load(f)
# Predict sentiment
def predict_sentiment(text):
text = text.lower()
text = re.sub(r'[^\w\s]', '', text)
sequence = tokenizer.texts_to_sequences([text])
padded_sequence = pad_sequences(sequence, maxlen=100)
pred = model.predict(padded_sequence)
sentiment = np.argmax(pred)
return sentiment
# Example usage
text = "I love this product!"
print(predict_sentiment(text))