Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,11 +26,10 @@ def classify(text):
|
|
| 26 |
pred = torch.argmax(probs).item()
|
| 27 |
confidence = min(probs[pred].item(), 0.95) # 限制置信度最大为95%
|
| 28 |
percent = round(confidence * 100, 2)
|
| 29 |
-
result = f"
|
| 30 |
return result
|
| 31 |
|
| 32 |
|
| 33 |
-
|
| 34 |
# Gradio 界面
|
| 35 |
interface = gr.Interface(
|
| 36 |
fn=classify,
|
|
@@ -43,22 +42,18 @@ interface = gr.Interface(
|
|
| 43 |
title="🧠 Manipulative Language Detector / 操纵性语言识别器",
|
| 44 |
description="""
|
| 45 |
🔍 This tool detects **emotionally manipulative language** in English or Chinese digital communication.
|
| 46 |
-
🧪 The model was fine-tuned on a manually annotated dataset of 10,000 Chinese messages, categorized into four manipulation types.
|
| 47 |
-
|
| 48 |
---
|
| 49 |
|
| 50 |
📌 **Disclaimer / 免责声明:**
|
| 51 |
This system is for **research and educational purposes only**.
|
| 52 |
It **does not guarantee accuracy** and **should not be used as legal or clinical evidence**.
|
| 53 |
-
|
| 54 |
本工具仅用于**学术研究与教学演示**,不构成法律、医疗或其他正式用途的依据。
|
| 55 |
-
|
| 56 |
---
|
| 57 |
|
| 58 |
🤖 **Model Info**:
|
| 59 |
- Model: `LilithHu/mbert-manipulative-detector`
|
| 60 |
- Base: `mDeBERTa-v3` multilingual pre-trained model
|
| 61 |
-
- Fine-tuned using HuggingFace Transformers on labeled Chinese data
|
| 62 |
|
| 63 |
🌐 Built with Gradio and hosted on HuggingFace Spaces.
|
| 64 |
""",
|
|
|
|
| 26 |
pred = torch.argmax(probs).item()
|
| 27 |
confidence = min(probs[pred].item(), 0.95) # 限制置信度最大为95%
|
| 28 |
percent = round(confidence * 100, 2)
|
| 29 |
+
result = f"预测 / Prediction:\n{labels[pred]}\n📊 置信度 /Confidence: {percent}%"
|
| 30 |
return result
|
| 31 |
|
| 32 |
|
|
|
|
| 33 |
# Gradio 界面
|
| 34 |
interface = gr.Interface(
|
| 35 |
fn=classify,
|
|
|
|
| 42 |
title="🧠 Manipulative Language Detector / 操纵性语言识别器",
|
| 43 |
description="""
|
| 44 |
🔍 This tool detects **emotionally manipulative language** in English or Chinese digital communication.
|
|
|
|
|
|
|
| 45 |
---
|
| 46 |
|
| 47 |
📌 **Disclaimer / 免责声明:**
|
| 48 |
This system is for **research and educational purposes only**.
|
| 49 |
It **does not guarantee accuracy** and **should not be used as legal or clinical evidence**.
|
|
|
|
| 50 |
本工具仅用于**学术研究与教学演示**,不构成法律、医疗或其他正式用途的依据。
|
|
|
|
| 51 |
---
|
| 52 |
|
| 53 |
🤖 **Model Info**:
|
| 54 |
- Model: `LilithHu/mbert-manipulative-detector`
|
| 55 |
- Base: `mDeBERTa-v3` multilingual pre-trained model
|
| 56 |
+
- Fine-tuned using HuggingFace Transformers on 10,000 labeled Chinese data
|
| 57 |
|
| 58 |
🌐 Built with Gradio and hosted on HuggingFace Spaces.
|
| 59 |
""",
|