Gen-AI Developer Classroom notes 05/Jan/2026

Hugging face

  • Open Google Colab and create a new notebook.
  • Select the Runtime to T4-GPU (optional)
  • In the first cell, Enter %pip install transformers
  • Navigate to Refer Here and run the following
from transformers import pipeline

classifier = pipeline(
    "sentiment-analysis",
    model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")

# response = classifier("I like Large Language models very much")
# print(response)

response = classifier("I got irritate standing in line at airport")
print(response)
  • NLP/Transformer Tasks

    • classification
    • summarization
    • NER
    • Feature Extraction
    • Sentiment analysis
    • Text Generation
  • High level usage: pipeline. Refer Here for the google colab notebook

I want to classify text into a category

  • Input: India won World cup in Cricket
  • I want you to find a classifier which classifies the input and possible options are ['Sports', 'Politics', 'Technology']
classifier = pipeline('zero-shot-classification', model='facebook/bart-large-mnli')
# classifier code
sequence_to_classify = "India won World cup in Cricket"
candidate_labels = ["sports", "politics", "health", "business"]
classifier(sequence_to_classify, candidate_labels)

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading