dariolopez commited on
Commit
ca06006
1 Parent(s): 865696c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1,7 +1,9 @@
 
1
  from transformers import pipeline
2
  import gradio as gr
3
 
4
 
 
5
  pipe = pipeline("text-classification", model='hackathon-somos-nlp-2023/roberta-base-bne-finetuned-suicide-es')
6
 
7
 
@@ -10,6 +12,11 @@ def detect_suicide_comment(input):
10
 
11
 
12
  iface = gr.Interface(
13
- fn=detect_suicide_comment, inputs="text", outputs="text", allow_flagging="auto"
 
 
 
 
 
14
  )
15
  iface.launch()
 
1
+ import os
2
  from transformers import pipeline
3
  import gradio as gr
4
 
5
 
6
+ hf_writer = gr.HuggingFaceDatasetSaver(os.getenv('HF_API_TOKEN'), "suicide-comment-es")
7
  pipe = pipeline("text-classification", model='hackathon-somos-nlp-2023/roberta-base-bne-finetuned-suicide-es')
8
 
9
 
 
12
 
13
 
14
  iface = gr.Interface(
15
+ fn=detect_suicide_comment,
16
+ inputs="text",
17
+ outputs="text",
18
+ allow_flagging="manual",
19
+ flagging_options='Incorrect classification',
20
+ flagging_callback=hf_writer
21
  )
22
  iface.launch()