Edit model card

Install transformers library

!pip install transformers

Import necessary libraries

import pandas as pd from transformers import pipeline from google.colab import files

Upload the file

uploaded = files.upload()

Load the dataset

file_name = 'publications.csv' # Use the file name as uploaded df = pd.read_csv(file_name)

Display the first few rows of the dataset

df.head()

Load the zero-shot classification pipeline

classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")

Define the categories

candidate_labels = ["World", "Sports", "Business", "Science and Technology", "Entertainment", "Lifestyle"]

Classify each news article

results = []

for article in df['headline']: result = classifier(article, candidate_labels) category = result['labels'][0] results.append(category)

Add the results to the DataFrame

df['category'] = results

Display the categorized DataFrame

df.head(10)

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Examples
Inference API (serverless) is not available, repository is disabled.