Update main.py
Browse files
main.py
CHANGED
|
@@ -39,7 +39,7 @@ sentiment_model.eval()
|
|
| 39 |
|
| 40 |
def analyze_text(text):
|
| 41 |
# Tokenize input text for NER
|
| 42 |
-
ner_inputs = ner_tokenizer(text, max_length=
|
| 43 |
|
| 44 |
input_ids = ner_inputs['input_ids']
|
| 45 |
|
|
@@ -59,7 +59,7 @@ def analyze_text(text):
|
|
| 59 |
ner_labels = [f"{token}: {label}" for token, label in zip(tokens, ner_labels)]
|
| 60 |
|
| 61 |
# Tokenize input text for sentiment analysis
|
| 62 |
-
sentiment_inputs = sentiment_tokenizer(text, max_length=
|
| 63 |
|
| 64 |
# Perform sentiment analysis
|
| 65 |
with torch.no_grad():
|
|
|
|
| 39 |
|
| 40 |
def analyze_text(text):
|
| 41 |
# Tokenize input text for NER
|
| 42 |
+
ner_inputs = ner_tokenizer(text, max_length= 514, truncation= True, padding= "max_length", return_tensors="pt")
|
| 43 |
|
| 44 |
input_ids = ner_inputs['input_ids']
|
| 45 |
|
|
|
|
| 59 |
ner_labels = [f"{token}: {label}" for token, label in zip(tokens, ner_labels)]
|
| 60 |
|
| 61 |
# Tokenize input text for sentiment analysis
|
| 62 |
+
sentiment_inputs = sentiment_tokenizer(text, max_length= 514, truncation= True, padding= "max_length", return_tensors="pt")
|
| 63 |
|
| 64 |
# Perform sentiment analysis
|
| 65 |
with torch.no_grad():
|