Update README.md
Browse files
README.md
CHANGED
|
@@ -45,6 +45,11 @@ print(f"Sentiment Scores: {sentiment_score}")
|
|
| 45 |
|
| 46 |
```
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
## Using HDFS (H5)
|
| 49 |
|
| 50 |
Download DistilSentiNet-42M.h5 here: https://huggingface.co/Ravinthiran/DistilSenti-Net42M/blob/main/DistilSentiNet-42M.h5
|
|
@@ -61,7 +66,7 @@ from tensorflow.keras.preprocessing.sequence import pad_sequences
|
|
| 61 |
from tensorflow.keras.models import load_model
|
| 62 |
|
| 63 |
# Load the saved Keras model
|
| 64 |
-
model_hybrid = load_model('< DistilSentiNet-42M.h5 File Path >')
|
| 65 |
|
| 66 |
# Sample data
|
| 67 |
df = pd.read_csv("./train.csv")
|
|
@@ -100,3 +105,8 @@ new_text = "I recently started a new fitness program at a local wellness center,
|
|
| 100 |
predicted_sentiment, sentiment_score = predict_sentiment(new_text, tokenizer, model_hybrid)
|
| 101 |
|
| 102 |
print(f"The sentiment of the input text is: {predicted_sentiment} with scores {sentiment_score}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
```
|
| 47 |
|
| 48 |
+
## Using Keras
|
| 49 |
+
|
| 50 |
+
Download DistilSentiNet-42M.keras https://huggingface.co/Ravinthiran/Distilsenti-Net-42M/blob/main/DistilSentiNet-42M.keras
|
| 51 |
+
|
| 52 |
+
|
| 53 |
## Using HDFS (H5)
|
| 54 |
|
| 55 |
Download DistilSentiNet-42M.h5 here: https://huggingface.co/Ravinthiran/DistilSenti-Net42M/blob/main/DistilSentiNet-42M.h5
|
|
|
|
| 66 |
from tensorflow.keras.models import load_model
|
| 67 |
|
| 68 |
# Load the saved Keras model
|
| 69 |
+
model_hybrid = load_model('< DistilSentiNet-42M.h5 File Path > or < DistilSentiNet-42M.keras File Path >')
|
| 70 |
|
| 71 |
# Sample data
|
| 72 |
df = pd.read_csv("./train.csv")
|
|
|
|
| 105 |
predicted_sentiment, sentiment_score = predict_sentiment(new_text, tokenizer, model_hybrid)
|
| 106 |
|
| 107 |
print(f"The sentiment of the input text is: {predicted_sentiment} with scores {sentiment_score}")
|
| 108 |
+
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
sample text = `I visited the new bookstore downtown yesterday. It has a variety of books across different genres. The layout is organized, and the staff is present if you need assistance. The store has a café section where you can sit and read. It's a quiet place, ideal for spending a few hours. Overall, it's a standard bookstore that offers the expected services without any notable highlights or drawbacks.`
|
| 112 |
+
The sentiment of the input text is: negative with scores [0.9463438 0.04554183 0.00811444]
|