MarieAngeA13
commited on
Commit
•
e54225d
1
Parent(s):
27c5f6a
Update Sentiment_analysis_with_bert.py
Browse files
Sentiment_analysis_with_bert.py
CHANGED
@@ -22,7 +22,15 @@ from torch import nn, optim
|
|
22 |
from torch.utils.data import Dataset, DataLoader
|
23 |
import torch.nn.functional as F
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
|
|
|
|
|
|
|
26 |
|
27 |
sns.set(style='whitegrid', palette='muted', font_scale=1.2)
|
28 |
|
@@ -520,8 +528,4 @@ def generate_improved_text(review_text, predicted_sentiment):
|
|
520 |
|
521 |
return improved_text
|
522 |
|
523 |
-
from transformers import BertModel
|
524 |
-
|
525 |
-
bert_model = BertModel.from_pretrained('bert-base-uncased')
|
526 |
|
527 |
-
bert_model.save_pretrained('C:/Users/Marie-Ange/Downloads')
|
|
|
22 |
from torch.utils.data import Dataset, DataLoader
|
23 |
import torch.nn.functional as F
|
24 |
|
25 |
+
from transformers import BertModel
|
26 |
+
|
27 |
+
bert_model = BertModel.from_pretrained('bert-base-uncased')
|
28 |
+
|
29 |
+
bert_model.save_pretrained('C:/Users/Marie-Ange/Downloads')
|
30 |
|
31 |
+
from transformers import pipeline
|
32 |
+
pipe = pipeline(model="Group209/Sentiment_Analysis")
|
33 |
+
pipe("Sentiment_analysis_with_bert.py")
|
34 |
|
35 |
sns.set(style='whitegrid', palette='muted', font_scale=1.2)
|
36 |
|
|
|
528 |
|
529 |
return improved_text
|
530 |
|
|
|
|
|
|
|
531 |
|
|