Vijayendra commited on
Commit
14617a0
·
verified ·
1 Parent(s): 1447857

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -11
README.md CHANGED
@@ -14,28 +14,36 @@ Use the code below to get started with the model.
14
 
15
  from transformers import T5ForConditionalGeneration, T5Tokenizer
16
 
17
- # Load the model and tokenizer from Hugging Face repository
18
 
19
  model = T5ForConditionalGeneration.from_pretrained("Vijayendra/T5-Base-Sum")
20
  tokenizer = T5Tokenizer.from_pretrained("Vijayendra/T5-Base-Sum")
21
 
22
- # Example of using the model for summarization
23
 
24
- article = """
25
- 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
26
- 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
27
- 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
28
- 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).
29
- Excluding transmitters, it is the second tallest free-standing structure in France after the Millau Viaduct.
 
 
30
  """
31
- inputs = tokenizer.encode("summarize: " + article, return_tensors="pt", max_length=512, truncation=True)
32
- summary_ids = model.generate(inputs, max_length=150, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True)
 
 
 
 
 
 
33
 
34
  # Decode and print the summary
35
 
36
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
 
37
  print(summary)
38
 
39
-
40
  [More Information Needed]
41
 
 
14
 
15
  from transformers import T5ForConditionalGeneration, T5Tokenizer
16
 
17
+ # Load the model and tokenizer from your Hugging Face repository
18
 
19
  model = T5ForConditionalGeneration.from_pretrained("Vijayendra/T5-Base-Sum")
20
  tokenizer = T5Tokenizer.from_pretrained("Vijayendra/T5-Base-Sum")
21
 
22
+ # Example of a random article (can replace this with any article)
23
 
24
+ random_article = """
25
+ Videos that say approved vaccines are dangerous and cause autism, cancer or infertility are among those that will be taken down, the company said. The policy includes the
26
+ termination of accounts of anti-vaccine influencers. Tech giants have been criticised for not doing more to counter false health information on their sites. In July, US President
27
+ Joe Biden said social media platforms were largely responsible for people's scepticism in getting vaccinated by spreading misinformation, and appealed for them to address the
28
+ issue. YouTube, which is owned by Google, said 130,000 videos were removed from its platform since last year, when it implemented a ban on content spreading misinformation
29
+ about Covid vaccines. In a blog post, the company said it had seen false claims about Covid jabs "spill over into misinformation about vaccines in general". The new policy
30
+ covers long-approved vaccines, such as those against measles or hepatitis B. "We're expanding our medical misinformation policies on YouTube with new guidelines on currently
31
+ administered vaccines that are approved and confirmed to be safe and effective by local health authorities and the WHO," the post said, referring to the World Health Organization.
32
  """
33
+
34
+ # Tokenize the input article
35
+
36
+ inputs = tokenizer.encode("summarize: " + random_article, return_tensors="pt", max_length=512, truncation=True)
37
+
38
+ # Generate summary
39
+
40
+ summary_ids = model.generate(inputs, max_length=150, min_length=100, length_penalty=3.0, num_beams=7, early_stopping=False)
41
 
42
  # Decode and print the summary
43
 
44
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
45
+ print("Summary:")
46
  print(summary)
47
 
 
48
  [More Information Needed]
49