Spaces:
Runtime error
Runtime error
Commit
·
1190945
1
Parent(s):
3febeb0
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,13 +8,14 @@ pipe = pipeline("text-classification", model='hackathon-somos-nlp-2023/roberta-b
|
|
| 8 |
|
| 9 |
|
| 10 |
def detect_suicide_comment(input):
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
iface = gr.Interface(
|
| 15 |
fn=detect_suicide_comment,
|
| 16 |
inputs="text",
|
| 17 |
-
outputs="
|
| 18 |
allow_flagging="manual",
|
| 19 |
flagging_options=['Correct Classification', 'Incorrect Classification'],
|
| 20 |
flagging_callback=hf_writer,
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def detect_suicide_comment(input):
|
| 11 |
+
result = pipe(input)[0]
|
| 12 |
+
return {result['label']: result['score']}
|
| 13 |
|
| 14 |
|
| 15 |
iface = gr.Interface(
|
| 16 |
fn=detect_suicide_comment,
|
| 17 |
inputs="text",
|
| 18 |
+
outputs=gr.Label(num_top_classes=1, type="confidences"),
|
| 19 |
allow_flagging="manual",
|
| 20 |
flagging_options=['Correct Classification', 'Incorrect Classification'],
|
| 21 |
flagging_callback=hf_writer,
|