william1324 commited on
Commit
aaa9302
·
verified ·
1 Parent(s): 7038599

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -10,12 +10,14 @@ def analyze_sentiment(text):
10
  label = result["label"]
11
  score = round(result["score"], 4)
12
 
13
- if label == "0":
14
  sentiment = "負向情緒"
15
- elif label == "1":
16
  sentiment = "中立情緒"
17
- elif label == "2":
18
  sentiment = "正向情緒"
 
 
19
 
20
  return f"判斷結果:{sentiment}\n信心分數:{score}"
21
 
 
10
  label = result["label"]
11
  score = round(result["score"], 4)
12
 
13
+ if label == "LABEL_0":
14
  sentiment = "負向情緒"
15
+ elif label == "LABEL_1":
16
  sentiment = "中立情緒"
17
+ elif label == "LABEL_2":
18
  sentiment = "正向情緒"
19
+ else:
20
+ sentiment = "無法判斷"
21
 
22
  return f"判斷結果:{sentiment}\n信心分數:{score}"
23