Update app.py
Browse files
app.py
CHANGED
|
@@ -74,16 +74,16 @@ def predict(text: str):
|
|
| 74 |
|
| 75 |
return {
|
| 76 |
"情感": sentiment_map[pred_class],
|
| 77 |
-
"
|
| 78 |
-
"
|
| 79 |
-
"
|
| 80 |
-
"
|
| 81 |
-
"
|
| 82 |
}
|
| 83 |
except Exception as e:
|
| 84 |
return {"错误": f"处理失败: {str(e)}"}
|
| 85 |
|
| 86 |
-
article = "Author: Lu Yuk Tong, [Github](https://github.com/LutherYTT/Cantonese-Sentiment-Analysis-System-Multitasking-Learning-on-Scarce-Data)"
|
| 87 |
# Create Gradio interface
|
| 88 |
iface = gr.Interface(
|
| 89 |
fn=predict,
|
|
|
|
| 74 |
|
| 75 |
return {
|
| 76 |
"情感": sentiment_map[pred_class],
|
| 77 |
+
"強度": round(rating, 2),
|
| 78 |
+
"喜": round(delight, 2),
|
| 79 |
+
"怒": round(anger, 2),
|
| 80 |
+
"哀": round(sorrow, 2),
|
| 81 |
+
"樂": round(happiness, 2),
|
| 82 |
}
|
| 83 |
except Exception as e:
|
| 84 |
return {"错误": f"处理失败: {str(e)}"}
|
| 85 |
|
| 86 |
+
article = "Author: Lu Yuk Tong, [Github Link](https://github.com/LutherYTT/Cantonese-Sentiment-Analysis-System-Multitasking-Learning-on-Scarce-Data)"
|
| 87 |
# Create Gradio interface
|
| 88 |
iface = gr.Interface(
|
| 89 |
fn=predict,
|