Update README.md
Browse files
README.md
CHANGED
@@ -21,8 +21,39 @@ This model is based on the Facebook BART (Bidirectional and Auto-Regressive Tran
|
|
21 |
### Installation:
|
22 |
|
23 |
You can install the necessary libraries using pip:
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
### Installation:
|
22 |
|
23 |
You can install the necessary libraries using pip:
|
24 |
+
```bash
|
25 |
+
pip install transformers
|
26 |
+
```
|
27 |
+
### Inferecnce
|
28 |
+
```python
|
29 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
30 |
+
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained("suriya7/text_summarize")
|
32 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("suriya7/text_summarize")
|
33 |
+
|
34 |
+
def generate_summary(text):
|
35 |
+
inputs = tokenizer([text], max_length=1024, return_tensors='pt', truncation=True)
|
36 |
+
summary_ids = model.generate(inputs['input_ids'], max_new_tokens=100, do_sample=False)
|
37 |
+
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
38 |
+
return summary
|
39 |
+
|
40 |
+
text_to_summarize = "Now, there is no doubt that one of the most important aspects of any Pixel phone is its camera. And there might be good news for all camera lovers. Rumours have suggested that the Pixel 9 could come with a telephoto lens, improving its photography capabilities even further. Google will likely continue to focus on using AI to enhance its camera performance, in order to make sure that Pixel phones remain top contenders in the world of mobile photography."
|
41 |
+
summary = generate_summary(text_to_summarize)
|
42 |
+
print(summary)
|
43 |
+
```
|
44 |
+
|
45 |
+
```
|
46 |
+
Cristiano Ronaldo dos Santos Aveiro => person
|
47 |
+
5 February 1985 => date
|
48 |
+
Saudi Pro League => competitions
|
49 |
+
Al Nassr => teams
|
50 |
+
Portugal national team => teams
|
51 |
+
Ballon d'Or => award
|
52 |
+
UEFA Men's Player of the Year Awards => award
|
53 |
+
European Golden Shoes => award
|
54 |
+
UEFA Champions Leagues => competitions
|
55 |
+
UEFA European Championship => competitions
|
56 |
+
UEFA Nations League => competitions
|
57 |
+
Champions League => competitions
|
58 |
+
European Championship => competitions
|
59 |
+
```
|