Vijayendra commited on
Commit
a1b5b4c
·
verified ·
1 Parent(s): c3f7289

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -1
README.md CHANGED
@@ -4,4 +4,26 @@ language:
4
  - en
5
  base_model:
6
  - google-t5/t5-base
7
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - en
5
  base_model:
6
  - google-t5/t5-base
7
+ ---
8
+
9
+ Example Use:
10
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
11
+
12
+ # Load the model and tokenizer from your Hugging Face repository
13
+ model = T5ForConditionalGeneration.from_pretrained("Vijayendra/T5-Base-Sum")
14
+ tokenizer = T5Tokenizer.from_pretrained("Vijayendra/T5-Base-Sum")
15
+
16
+ # Example of using the model for summarization
17
+ article = """
18
+ The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring
19
+ 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the
20
+ world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300
21
+ metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft).
22
+ Excluding transmitters, it is the second tallest free-standing structure in France after the Millau Viaduct.
23
+ """
24
+ inputs = tokenizer.encode("summarize: " + article, return_tensors="pt", max_length=512, truncation=True)
25
+ summary_ids = model.generate(inputs, max_length=150, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True)
26
+
27
+ # Decode and print the summary
28
+ summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
29
+ print(summary)