erikacardenas300 commited on
Commit
5086aac
·
1 Parent(s): 7b35f8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -14
app.py CHANGED
@@ -5,21 +5,11 @@ os.system('pip install TextBlob')
5
 
6
  import streamlit as st
7
  from transformers import pipeline
8
- from textblob import TextBlob
9
 
10
  pipe = pipeline('sentiment-analysis')
11
- st.title("Hugging Face Sentiment Analysis Spaces Example")
12
- st.subheader("What framework would you like to use for Sentiment Analysis")
13
- #Picking what NLP task you want to do
14
- option = st.selectbox('Framework',('Transformers', 'TextBlob')) #option is stored in this variable
15
- #Textbox for text user is entering
16
- st.subheader("Enter the text you'd like to analyze.")
17
- text = st.text_input('Enter text') #text is stored in this variable
18
 
19
- if option == 'Transformers':
20
  out = pipe(text)
21
- else:
22
- out = TextBlob(text)
23
- out = out.sentiment
24
- st.write("Sentiment of Text: ")
25
- st.write(out)
 
5
 
6
  import streamlit as st
7
  from transformers import pipeline
8
+
9
 
10
  pipe = pipeline('sentiment-analysis')
11
+ text = st.text_area('Enter text')
 
 
 
 
 
 
12
 
13
+ if text:
14
  out = pipe(text)
15
+ st.json(out)