Upload 3 files
Browse files- README.md +51 -0
- tf_model.h5 +3 -0
- tf_model.preproc +0 -0
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# BERT Sentiment Classifier
|
| 3 |
+
|
| 4 |
+
This model is a fine-tuned version of BERT (Bidirectional Encoder Representations from Transformers) designed to classify text sentiment into positive or negative. It's trained on a large corpus of movie reviews and can be adapted for similar natural language processing tasks.
|
| 5 |
+
|
| 6 |
+
## Requirements
|
| 7 |
+
|
| 8 |
+
To use this model, you need the following packages:
|
| 9 |
+
|
| 10 |
+
- TensorFlow 2.x
|
| 11 |
+
- ktrain
|
| 12 |
+
|
| 13 |
+
## Installation
|
| 14 |
+
|
| 15 |
+
First, ensure you have Python 3.6 or newer installed. Then, install the required packages using pip:
|
| 16 |
+
|
| 17 |
+
```bash
|
| 18 |
+
pip install tensorflow ktrain
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
## Loading the Predictor
|
| 22 |
+
|
| 23 |
+
To load the predictor, use the following code snippet. Ensure the model directory ('./model') is correctly specified to the location where you've downloaded the model files.
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
import ktrain
|
| 27 |
+
predictor = ktrain.load_predictor('./model')
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Making Predictions
|
| 31 |
+
|
| 32 |
+
You can make predictions with the model as follows:
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
text = "I absolutely loved this movie! The acting was great and the story was compelling."
|
| 36 |
+
prediction = predictor.predict(text)
|
| 37 |
+
print("Sentiment:", "Positive" if prediction[0] == 1 else "Negative")
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Model Files
|
| 41 |
+
|
| 42 |
+
This model repository includes the following files:
|
| 43 |
+
|
| 44 |
+
- `tf_model.h5`: The model weights.
|
| 45 |
+
- `tf_model.preproc`: The preprocessing data for the model inputs, ensuring input data is in the correct format for prediction.
|
| 46 |
+
|
| 47 |
+
## Additional Notes
|
| 48 |
+
|
| 49 |
+
This model is intended for educational and research purposes. It may require further tuning for optimal performance on specific tasks.
|
| 50 |
+
|
| 51 |
+
For any questions or issues, please open an issue in the repository or contact the model maintainers.
|
tf_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:30b27d15ae5805ac6ad54adeb19419b1b57289d441e4c04de04f5625419836de
|
| 3 |
+
size 1313085280
|
tf_model.preproc
ADDED
|
Binary file (871 kB). View file
|
|
|