nickprock's picture
Update app.py
753b62b
raw
history blame contribute delete
595 Bytes
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()