Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load the sentiment analysis pipeline
|
| 5 |
+
classifier = pipeline("sentiment-analysis")
|
| 6 |
+
|
| 7 |
+
# Create a title for your app
|
| 8 |
+
st.title("Sentiment Analysis App")
|
| 9 |
+
|
| 10 |
+
# Create a text input box for the user
|
| 11 |
+
text = st.text_area("Enter text for vibe check:")
|
| 12 |
+
|
| 13 |
+
# Analyze the sentiment of the text when the user clicks the button
|
| 14 |
+
if st.button("Analyze"):
|
| 15 |
+
result = classifier(text)
|
| 16 |
+
st.write("Sentiment:", result[0]["label"])
|
| 17 |
+
st.write("Confidence:", result[0]["score"])
|