rajesh1729 commited on
Commit
d4cb7bd
·
1 Parent(s): bc801bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -9,17 +9,6 @@ side = st.sidebar.selectbox("Select an option below", ("Sentiment", "Subjectivit
9
  Text = st.text_input("Enter the sentence")
10
 
11
 
12
- @st.cache
13
- def sentiment(text):
14
- nlp = spacy.load('en_core_web_sm')
15
- nlp.add_pipe('spacytextblob')
16
- doc = nlp(text)
17
- if doc._.polarity<0:
18
- return "Negative"
19
- elif doc._.polarity==0:
20
- return "Neutral"
21
- else:
22
- return "Positive"
23
 
24
  @st.cache
25
  def subjectivity(text):
@@ -43,6 +32,18 @@ def ner(sentence):
43
 
44
 
45
  def run():
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  if side == "Sentiment":
48
  st.write(sentiment(Text))
 
9
  Text = st.text_input("Enter the sentence")
10
 
11
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  @st.cache
14
  def subjectivity(text):
 
32
 
33
 
34
  def run():
35
+ @st.cache
36
+ def sentiment(text):
37
+ nlp = spacy.load('en_core_web_sm')
38
+ nlp.add_pipe('spacytextblob')
39
+ doc = nlp(text)
40
+ if doc._.polarity<0:
41
+ return "Negative"
42
+ elif doc._.polarity==0:
43
+ return "Neutral"
44
+ else:
45
+ return "Positive"
46
+
47
 
48
  if side == "Sentiment":
49
  st.write(sentiment(Text))