Spaces:
Runtime error
Runtime error
File size: 546 Bytes
ca06006 8475c22 ca06006 2aa9dad 8475c22 cb110ca 8475c22 a3a02f1 ca06006 a3a02f1 8475c22 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|