Spaces:
Sleeping
Sleeping
File size: 595 Bytes
554dae3 d479f30 554dae3 5781233 bb55b07 554dae3 7ad2f16 554dae3 dc0c5bf 554dae3 753b62b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from setfit import SetFitModel
model = SetFitModel.from_pretrained("nickprock/setfit-italian-hate-speech")
dictionary={0:'not-hateful',
1:'hateful'}
def greet(text, dictionary=dictionary):
response = model([text])
return dictionary[response[0].item()]
demo = gr.Interface(fn=greet,
inputs="text",
outputs="text",
title="Italian Hate Speech",
description="Detect Hate Speech",
examples=[["Brutta e bugiarada da fare schifo"],["a chi ruba tagliare la mano,ci penserebbero bene!"],["Mi piace la pizza ai peperoni!"]],
cache_examples=False)
demo.launch() |