File size: 671 Bytes
e93974b 5ea0581 3465768 5ea0581 e93974b 5ea0581 e93974b 10263c2 5ea0581 e93974b 5ea0581 e93974b 5ea0581 05e16e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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()
|