dariolopez's picture
Update app.py
ca06006
raw
history blame
546 Bytes
import os
from transformers import pipeline
import gradio as gr
hf_writer = gr.HuggingFaceDatasetSaver(os.getenv('HF_API_TOKEN'), "suicide-comment-es")
pipe = pipeline("text-classification", model='hackathon-somos-nlp-2023/roberta-base-bne-finetuned-suicide-es')
def detect_suicide_comment(input):
return pipe(input)
iface = gr.Interface(
fn=detect_suicide_comment,
inputs="text",
outputs="text",
allow_flagging="manual",
flagging_options='Incorrect classification',
flagging_callback=hf_writer
)
iface.launch()