peace4ever
commited on
Commit
•
e3bdd13
1
Parent(s):
e8e622a
Update app.py
Browse files
app.py
CHANGED
@@ -10,21 +10,21 @@ text = st.text_area("Өгүүлбэр оруулна уу?")
|
|
10 |
|
11 |
if text is not None:
|
12 |
predictions = pipeline(text)
|
13 |
-
|
|
|
14 |
col1, col2 = st.columns(2)
|
15 |
col1.header("Sentiment")
|
16 |
col2.header("Probability")
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
sentiment = "Positive"
|
25 |
|
26 |
-
|
27 |
-
|
28 |
# label = predictions[0]["label"]
|
29 |
# probability = predictions[0]["score"]
|
30 |
# col1.write(label)
|
|
|
10 |
|
11 |
if text is not None:
|
12 |
predictions = pipeline(text)
|
13 |
+
label = predictions[0]["label"]
|
14 |
+
probability = predictions[0]["score"]
|
15 |
col1, col2 = st.columns(2)
|
16 |
col1.header("Sentiment")
|
17 |
col2.header("Probability")
|
18 |
|
19 |
+
if label == "entailment":
|
20 |
+
sentiment = "Negative"
|
21 |
+
elif label == "contradiction":
|
22 |
+
sentiment = "Neutral"
|
23 |
+
elif label == "neutral":
|
24 |
+
sentiment = "Positive"
|
|
|
25 |
|
26 |
+
col1.write(sentiment)
|
27 |
+
col2.write(f"{probability:.2f}")
|
28 |
# label = predictions[0]["label"]
|
29 |
# probability = predictions[0]["score"]
|
30 |
# col1.write(label)
|