Spaces:
Paused
Paused
File size: 535 Bytes
e817dcf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from transformers import pipeline
pipe = pipeline("text-classification", model="jazbarr/jazbarr-toxicidad")
def analizar_texto(texto):
resultado = pipe(texto)[0]
label = resultado['label']
score = resultado['score']
if label == 'LABEL_1':
return f'This comment is toxic (score: {score})'
else:
return f'This comment is not toxic (score: {score}'
import gradio as gr
demo = gr.Interface(
fn=analizar_texto,
inputs=gr.Textbox(label='write a comment'),
outputs=gr.Textbox(label='result')
)
demo.launch() |