Skip to content

Instantly share code, notes, and snippets.

@vinimonteiro
Created December 18, 2021 20:59
Show Gist options
  • Save vinimonteiro/b1c9b1da110fe2c882b2648c3d021f2b to your computer and use it in GitHub Desktop.
Save vinimonteiro/b1c9b1da110fe2c882b2648c3d021f2b to your computer and use it in GitHub Desktop.
summarizer_pipelineapi
from transformers import pipeline
summarization = pipeline("summarization")
original_text = """
In another experiment, participants would have their brains scanned at the same time as being blindfolded. They would perform various touching tasks while having the brain mapped out. It was noticed that brain reorganization would happen as rapidly as in 40 to 60 minutes!
Considering how quickly the brain reorganizes, it’s suggested that dreams are a defence mechanism. When we go to sleep, our vision cortex finds itself at a disadvantage. If you think about it, it’s the only sense lost — we still hear, taste, feel and smell. It’s unfair.
The brain, to protect the visual cortex from being taken over, creates images and videos internally (the dreams), and we see with our eyes shut. This way, vision is safe.
"""
summary = summarization(original_text)[0]['summary_text']
print("Summary:", summary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment