Update DataLoader.py
Browse files- DataLoader.py +3 -3
DataLoader.py
CHANGED
@@ -7,7 +7,7 @@ import matplotlib.pyplot as plt
|
|
7 |
import yfinance as yf
|
8 |
from datetime import datetime
|
9 |
from pygooglenews import GoogleNews
|
10 |
-
from transformers import
|
11 |
from transformers import pipeline
|
12 |
class DataLoader:
|
13 |
def __init__(self, ticker, time_period_news, time_period_stock, news_decay_rate = 0):
|
@@ -45,8 +45,8 @@ class DataLoader:
|
|
45 |
return news_data
|
46 |
|
47 |
def get_sentiment(self, news_data):
|
48 |
-
tokenizer =
|
49 |
-
model =
|
50 |
classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
51 |
|
52 |
news_sentiment = []
|
|
|
7 |
import yfinance as yf
|
8 |
from datetime import datetime
|
9 |
from pygooglenews import GoogleNews
|
10 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
11 |
from transformers import pipeline
|
12 |
class DataLoader:
|
13 |
def __init__(self, ticker, time_period_news, time_period_stock, news_decay_rate = 0):
|
|
|
45 |
return news_data
|
46 |
|
47 |
def get_sentiment(self, news_data):
|
48 |
+
tokenizer = AutoTokenizer.from_pretrained("ProsusAI/finbert")
|
49 |
+
model = AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert")
|
50 |
classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
51 |
|
52 |
news_sentiment = []
|