Testys commited on
Commit
48ee746
1 Parent(s): 31cea2f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
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, return_tensors="pt")
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, return_tensors="pt")
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= 1024, 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= 1024, truncation= True, padding= "max_length", return_tensors="pt")
63
 
64
  # Perform sentiment analysis
65
  with torch.no_grad():