Update README.md
Browse files
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
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
"""
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|