Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,14 +13,19 @@ def sentiment_analysis(inp):
|
|
13 |
return res
|
14 |
|
15 |
def main():
|
16 |
-
|
|
|
|
|
17 |
st.write("You entered:", user_input)
|
18 |
res = sentiment_analysis(user_input)
|
19 |
print(res)
|
|
|
|
|
20 |
sentiment = res[0]['label']
|
21 |
conf = res[0]['score']
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
if __name__ == '__main__':
|
26 |
main()
|
|
|
13 |
return res
|
14 |
|
15 |
def main():
|
16 |
+
st.header("Check the sentiment of your text")
|
17 |
+
my_string = 'Hello, it was fun making this streamlit application.'
|
18 |
+
user_input = st.text_input("Enter text here:", value=my_string)
|
19 |
st.write("You entered:", user_input)
|
20 |
res = sentiment_analysis(user_input)
|
21 |
print(res)
|
22 |
+
with st.form("my_form"):
|
23 |
+
submit_button = st.form_submit_button(label='Submit')
|
24 |
sentiment = res[0]['label']
|
25 |
conf = res[0]['score']
|
26 |
+
if submit_button:
|
27 |
+
st.write("Sentiment of the input: ", sentiment)
|
28 |
+
st.write("Confidence of the predicted sentiment: ", conf)
|
29 |
|
30 |
if __name__ == '__main__':
|
31 |
main()
|