|
|
|
from transformers import pipeline |
|
import gradio as gr |
|
import tensorflow |
|
|
|
model_name = "facebook/bart-large-mnli" |
|
|
|
class_labels = ["Misconduct" , "Negligence" , "Discrimination" , "Corruption" , "Violation of Rights" , "Inefficiency" , |
|
"Unprofessional Conduct", "Response Time" , "Use of Firearms" , "Property Damage"] |
|
|
|
|
|
classifier = pipeline("zero-shot-classification", model=model_name) |
|
|
|
def zeroshotclassification(input_text): |
|
issue = classifier(input_text , class_labels , multi_label = False)['labels'][0] |
|
return issue |
|
|
|
iface = gr.Interface( |
|
fn=zeroshotclassification, |
|
inputs=[ |
|
"text" |
|
], |
|
outputs=["text"] |
|
) |
|
iface.launch() |
|
|