Spaces:
Sleeping
Sleeping
Commit ·
b9a5094
1
Parent(s): 2569884
create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Create a sentiment analysis pipeline
|
| 5 |
+
pipe = pipeline('sentiment-analysis')
|
| 6 |
+
|
| 7 |
+
# Streamlit UI code
|
| 8 |
+
st.title("Sentiment Analysis App")
|
| 9 |
+
text = st.text_area('Enter some text:', '') # Provide an initial value for the text_area
|
| 10 |
+
|
| 11 |
+
if text:
|
| 12 |
+
out = pipe(text)
|
| 13 |
+
st.subheader("Sentiment Analysis Result:")
|
| 14 |
+
st.json(out) # Display sentiment analysis result as JSON
|