Skip to content

Instantly share code, notes, and snippets.

@manmohan24nov
Created November 10, 2020 18:38
Show Gist options
  • Save manmohan24nov/ea4c2b9450ad0f7489290e08d4cd7a21 to your computer and use it in GitHub Desktop.
Save manmohan24nov/ea4c2b9450ad0f7489290e08d4cd7a21 to your computer and use it in GitHub Desktop.
>>> from transformers import pipeline
>>> summarizer = pipeline('summarization', model='facebook/bart-large-cnn', tokenizer='facebook/bart-large-cnn')
>>> text = ".".join(comment_section)
>>> summarizer(text, min_length = round(0.1 * len(text.split(' '))), max_length = round(0.2 * len(text.split(' '))), do_sample=False)
[{'summary_text': "england would fall before there comes a day when the queen doesn't have tea.
She also regularly has wine with her meals. When someone gets to 100 years old in england they get a letter from the queen."}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment