Spaces:
Sleeping
Sleeping
code update
Browse filesCode improvement with comments
app.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
from transformers import pipeline
|
| 4 |
|
|
|
|
|
|
|
| 5 |
pipe = pipeline('sentiment-analysis', model = 'SamLowe/roberta-base-go_emotions')
|
| 6 |
-
text = st.text_area('Enter given text here')
|
| 7 |
|
|
|
|
| 8 |
st.title ('Check the sentiment of your email before sending it outππππβ€οΈ')
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
if text:
|
| 11 |
out = pipe(text)
|
| 12 |
st.json(out)
|
|
|
|
| 1 |
+
#import necessary libraries
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
+
#buidling a sentiment pipeline
|
| 6 |
+
|
| 7 |
pipe = pipeline('sentiment-analysis', model = 'SamLowe/roberta-base-go_emotions')
|
|
|
|
| 8 |
|
| 9 |
+
#give a title to app
|
| 10 |
st.title ('Check the sentiment of your email before sending it outππππβ€οΈ')
|
| 11 |
|
| 12 |
+
#text field for user to input data
|
| 13 |
+
text = st.text_area('Enter given text here')
|
| 14 |
+
|
| 15 |
+
# output formated in json format
|
| 16 |
if text:
|
| 17 |
out = pipe(text)
|
| 18 |
st.json(out)
|