import gradio as gr from transformers import pipeline umbrellaSubjects = [ "Science, Technology, Engineering, Mathematics", "Philosophy", "Arts and Humanities", "Social Sciences", "Languages", "Professional Studies" ] classifier = pipeline("zero-shot-classification", model="vicgalle/xlm-roberta-large-xnli-anli") def process_string(string): # Remove whitespace from string string = string.replace(' ', '') # Split string by comma string_list = string.split(',') # Return list with no whitespace return [term.strip() for term in string_list] def classify(sentences,categories): return classifier(process_string(sentences),process_string(categories))