Spaces:
Runtime error
Runtime error
second commit
Browse files
app.py
CHANGED
@@ -4,8 +4,15 @@ from transformers import pipeline
|
|
4 |
pipe=pipeline('sentiment-analysis')
|
5 |
# Set the title
|
6 |
st.title("Sentiment Analysis")
|
7 |
-
|
|
|
8 |
|
9 |
if text:
|
10 |
out=pipe(text)
|
11 |
-
st.json(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
pipe=pipeline('sentiment-analysis')
|
5 |
# Set the title
|
6 |
st.title("Sentiment Analysis")
|
7 |
+
# Input for text to analyze sentiment
|
8 |
+
text = st.text_area("Enter text for sentiment analysis:")
|
9 |
|
10 |
if text:
|
11 |
out=pipe(text)
|
12 |
+
result=st.json(out)
|
13 |
+
sentiment = result["label"]
|
14 |
+
score = result["score"]
|
15 |
+
st.write(f"Sentiment: {sentiment}")
|
16 |
+
st.write(f"Sentiment Score: {score}")
|
17 |
+
else:
|
18 |
+
st.error(f"Error: {response.status_code}, {response.text}")
|