Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ def classify(text):
|
|
| 17 |
probs = torch.softmax(outputs.logits, dim=1)
|
| 18 |
pred = torch.argmax(probs, dim=1).item()
|
| 19 |
confidence = probs[0][pred].item()
|
| 20 |
-
return f"🧠 预测 / Prediction: {labels[pred]}\n📊 置信度
|
| 21 |
|
| 22 |
# Gradio 界面
|
| 23 |
interface = gr.Interface(
|
|
@@ -26,11 +26,6 @@ interface = gr.Interface(
|
|
| 26 |
outputs="text",
|
| 27 |
title="🔍 Manipulative Language Detector / 操纵性语言识别器",
|
| 28 |
description="🧪 输入英文或中文句子,系统将判断其是否包含操纵性语言。\nEnter a sentence in English or Chinese to detect if it's manipulative.",
|
| 29 |
-
examples=[
|
| 30 |
-
["If you really cared, you'd do what I say."],
|
| 31 |
-
["你不爱我就证明给我看!"],
|
| 32 |
-
["今天的天气真不错。"]
|
| 33 |
-
]
|
| 34 |
)
|
| 35 |
|
| 36 |
interface.launch()
|
|
|
|
| 17 |
probs = torch.softmax(outputs.logits, dim=1)
|
| 18 |
pred = torch.argmax(probs, dim=1).item()
|
| 19 |
confidence = probs[0][pred].item()
|
| 20 |
+
return f"🧠 预测 / Prediction: {labels[pred]}\n📊 置信度"
|
| 21 |
|
| 22 |
# Gradio 界面
|
| 23 |
interface = gr.Interface(
|
|
|
|
| 26 |
outputs="text",
|
| 27 |
title="🔍 Manipulative Language Detector / 操纵性语言识别器",
|
| 28 |
description="🧪 输入英文或中文句子,系统将判断其是否包含操纵性语言。\nEnter a sentence in English or Chinese to detect if it's manipulative.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
interface.launch()
|