from IPython.display import YouTubeVideo

YouTubeVideo('BqqfQnyjmgg')YouTubeVideo('1pedAIvTWXk')text = """Dear Amazon, last week I ordered an Optimus Prime action figure \
from your online store in Germany. Unfortunately, when I opened the package, \
I discovered to my horror that I had been sent an action figure of Megatron \
instead! As a lifelong enemy of the Decepticons, I hope you can understand my \
dilemma. To resolve the issue, I demand an exchange of Megatron for the \
Optimus Prime figure I ordered. Enclosed are copies of my records concerning \
this purchase. I expect to hear from you soon. Sincerely, Bumblebee."""import textwrap

wrapper = textwrap.TextWrapper(width=80, break_long_words=False, break_on_hyphens=False)
print(wrapper.fill(text))from transformers import pipeline

sentiment_pipeline = pipeline('text-classification')sentiment_pipeline(text)ner_pipeline = pipeline('ner')entities = ner_pipeline(text, aggregation_strategy="simple")
print(entities)for entity in entities:
    print(f"{entity['word']}: {entity['entity_group']} ({entity['score']:.2f})")qa_pipeline = pipeline("question-answering")question = "What does the customer want?"

outputs = qa_pipeline(question=question, context=text)
outputssummarization_pipeline = pipeline("summarization")outputs = summarization_pipeline(text, max_length=45, clean_up_tokenization_spaces=True)
print(wrapper.fill(outputs[0]['summary_text']))translator = pipeline("translation_en_to_de", model="Helsinki-NLP/opus-mt-en-de")outputs = translator(text, clean_up_tokenization_spaces=True, min_length=100)
print(wrapper.fill(outputs[0]['translation_text']))zero_shot_classifier = pipeline("zero-shot-classification",
                                model="vicgalle/xlm-roberta-large-xnli-anli")text = 'Dieser Tutorial ist großartig! Ich hoffe, dass jemand von Hugging Face meine Universität besuchen wird :)'
classes = ['Treffen', 'Arbeit', 'Digital', 'Reisen']zero_shot_classifier(text, classes, multi_label=True)from transformers import pipelines
for task in pipelines.SUPPORTED_TASKS:
    print(task)YouTubeVideo('00GKzGyWFEs')