import gradio as gr import torch from transformers import pipeline app_title = "Portuguese Hate Speech Detection" app_description = """ This app detects hate speech on Portuguese text using multiple models. You can either introduce your own sentences by filling in "Text" or click on one of the examples provided below. """ app_examples = [ ["As pessoas tem que perceber que ser 'panasca' não é deixar de ser homem, é deixar de ser humano hahaha"], ["Hoje tive uma conversa muito agradável com um colega meu"], ] output_textbox_component_description = """ This box will display the hate speech detection results based on the average score of multiple models. """ output_json_component_description = { "breakdown": """ This box presents a detailed breakdown of the evaluation for each model. """} pipe = pipeline("text-classification", model="knowhate/HateBERTimbau") demo = gr.Interface.from_pipeline(pipe) demo.launch()