Upload usage.py
Browse files12345678910111213141516171819202122import sysfrom transformers import pipeline
# Define candidate labels for classificationcandidate_labels_spam = ['Spam', 'not Spam']candidate_labels_urgent = ['Urgent', 'not Urgent']
model="MoritzLaurer/deberta-v3-large-zeroshot-v1.1-all-33"model="SpamUrgencyDetection"clf = pipeline("zero-shot-classification", model=model)def predict(text): p_spam = clf(text, candidate_labels_spam)["labels"][0] p_urgent = clf(text, candidate_labels_urgent)["labels"][0] return p_spam,p_urgent
import pandas as pddf = pd.read_csv("test.csv")
texts=df["text"]for i in range( len(texts)): print(texts[i],predict(texts[i]))usage.pyAdded+22