ahmedrachid commited on
Commit
11c83cd
1 Parent(s): 1c151cf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -9
README.md CHANGED
@@ -39,24 +39,24 @@ The evaluation metrics used are: Precision, Recall and F1-score. The following i
39
  ### How to use
40
  The model can be used thanks to Transformers pipeline for sentiment analysis.
41
  ```python
42
- >>> from transformers import BertTokenizer, BertForSequenceClassification
43
- >>> from transformers import pipeline
44
 
45
- >>> model = BertForSequenceClassification.from_pretrained("ahmedrachid/FinancialBERT-Sentiment-Analysis",num_labels=3)
46
- >>> tokenizer = BertTokenizer.from_pretrained("ahmedrachid/FinancialBERT-Sentiment-Analysis")
47
 
48
- >>> nlp = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
49
 
50
- >>> sentences = ["Operating profit rose to EUR 13.1 mn from EUR 8.7 mn in the corresponding period in 2007 representing 7.7 % of net sales.",
51
  "Bids or offers include at least 1,000 shares and the value of the shares must correspond to at least EUR 4,000.",
52
  "Raute reported a loss per share of EUR 0.86 for the first half of 2009 , against EPS of EUR 0.74 in the corresponding period of 2008.",
53
  ]
54
- >>> results = nlp(sentences)
55
- >>> print(results)
56
 
57
  [{'label': 'positive', 'score': 0.9998133778572083},
58
  {'label': 'neutral', 'score': 0.9997822642326355},
59
  {'label': 'negative', 'score': 0.9877365231513977}]
60
  ```
61
 
62
- >Created by [Ahmed Rachid Hazourli](https://www.linkedin.com/in/ahmed-rachid/)
 
39
  ### How to use
40
  The model can be used thanks to Transformers pipeline for sentiment analysis.
41
  ```python
42
+ from transformers import BertTokenizer, BertForSequenceClassification
43
+ from transformers import pipeline
44
 
45
+ model = BertForSequenceClassification.from_pretrained("ahmedrachid/FinancialBERT-Sentiment-Analysis",num_labels=3)
46
+ tokenizer = BertTokenizer.from_pretrained("ahmedrachid/FinancialBERT-Sentiment-Analysis")
47
 
48
+ nlp = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
49
 
50
+ sentences = ["Operating profit rose to EUR 13.1 mn from EUR 8.7 mn in the corresponding period in 2007 representing 7.7 % of net sales.",
51
  "Bids or offers include at least 1,000 shares and the value of the shares must correspond to at least EUR 4,000.",
52
  "Raute reported a loss per share of EUR 0.86 for the first half of 2009 , against EPS of EUR 0.74 in the corresponding period of 2008.",
53
  ]
54
+ results = nlp(sentences)
55
+ print(results)
56
 
57
  [{'label': 'positive', 'score': 0.9998133778572083},
58
  {'label': 'neutral', 'score': 0.9997822642326355},
59
  {'label': 'negative', 'score': 0.9877365231513977}]
60
  ```
61
 
62
+ > Created by [Ahmed Rachid Hazourli](https://www.linkedin.com/in/ahmed-rachid/)