panotedi commited on
Commit
3112e6e
·
unverified ·
1 Parent(s): ec17b06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -1,13 +1,14 @@
1
  import streamlit as st
2
- st.title("CS634 - milestone2 - Tedi Pano")
3
-
4
- text_input = st.text_input("Enter in a sentence for sentiment analysis" , "I love you so much it hurts sometimes")
5
-
6
  from transformers import pipeline
 
7
 
8
  sentiment_model = pipeline("sentiment-analysis")
9
 
10
- output = sentiment_model(text_input)
 
 
11
 
12
- if text_input != "":
13
- st.write("The sentiment analysis for '" + text_input+ "' is " + output[0]['label'] + " with a certainty score of " + str(output[0]['score']))
 
 
 
1
  import streamlit as st
 
 
 
 
2
  from transformers import pipeline
3
+ st.title("CS634 - milestone2 - Tedi Pano")
4
 
5
  sentiment_model = pipeline("sentiment-analysis")
6
 
7
+ with st.form("my_form"):
8
+ text_input = st.text_input("Enter in a sentence for sentiment analysis" , "i love you")
9
+ submitted = st.form_submit_button("Submit")
10
 
11
+
12
+ if submitted:
13
+ output = sentiment_model(text_input)
14
+ st.write("The sentiment analysis for '" + text_input+ "' is " + output[0]['label'] + " with a certainty score of " + str(output[0]['score']))