Spaces:
Running
Running
Update app.py
#1
by shdira - opened
app.py
CHANGED
|
@@ -12,7 +12,17 @@ st.subheader("Enter the text you want to analyze")
|
|
| 12 |
text = st.text_input('Enter text:') # text is stored in this variable
|
| 13 |
|
| 14 |
if option == 'Transformers':
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
else:
|
| 17 |
out = TextBlob(text)
|
| 18 |
out = out.sentiment
|
|
|
|
| 12 |
text = st.text_input('Enter text:') # text is stored in this variable
|
| 13 |
|
| 14 |
if option == 'Transformers':
|
| 15 |
+
result = pipe(text)[0]
|
| 16 |
+
|
| 17 |
+
label = result['label']
|
| 18 |
+
score = round(result['score'] * 100, 2)
|
| 19 |
+
|
| 20 |
+
if label == "POSITIVE":
|
| 21 |
+
emoji = "π"
|
| 22 |
+
else:
|
| 23 |
+
emoji = "π"
|
| 24 |
+
|
| 25 |
+
out = f"{emoji} {label} ({score}%)"
|
| 26 |
else:
|
| 27 |
out = TextBlob(text)
|
| 28 |
out = out.sentiment
|