rafaelm47labs commited on
Commit
6866bd4
1 Parent(s): 64320bb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -2
README.md CHANGED
@@ -73,6 +73,10 @@ print(nlp(review_text))
73
 
74
  ```{python}
75
 
 
 
 
 
76
  model_name = 'M47Labs/spanish_news_classification_headlines'
77
  MAX_LEN = 32
78
 
@@ -94,8 +98,8 @@ encoded_review = tokenizer.encode_plus(
94
  return_tensors='pt',
95
  )
96
 
97
- input_ids = encoded_review['input_ids']#.to(device)
98
- attention_mask = encoded_review['attention_mask']#.to(device)
99
  output = model(input_ids, attention_mask)
100
 
101
  _, prediction = torch.max(output['logits'], dim=1)
 
73
 
74
  ```{python}
75
 
76
+ import torch
77
+ from transformers import AutoTokenizer, BertForSequenceClassification,TextClassificationPipeline
78
+ from numpy import np
79
+
80
  model_name = 'M47Labs/spanish_news_classification_headlines'
81
  MAX_LEN = 32
82
 
 
98
  return_tensors='pt',
99
  )
100
 
101
+ input_ids = encoded_review['input_ids']
102
+ attention_mask = encoded_review['attention_mask']
103
  output = model(input_ids, attention_mask)
104
 
105
  _, prediction = torch.max(output['logits'], dim=1)