Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
def main():
|
5 |
-
st.title("Hugging Face Sentiment Analysis")
|
6 |
-
|
7 |
-
# User input for text
|
8 |
-
user_input = st.text_input("Enter some text:")
|
9 |
-
|
10 |
-
if user_input:
|
11 |
-
# Load sentiment analysis pipeline
|
12 |
-
sentiment_pipeline = pipeline("sentiment-analysis")
|
13 |
-
|
14 |
-
# Perform sentiment analysis
|
15 |
-
result = sentiment_pipeline(user_input)
|
16 |
-
|
17 |
-
# Display sentiment analysis result
|
18 |
-
st.write("Sentiment:", result[0]['label'], "- Confidence:", round(result[0]['score'], 4))
|
19 |
-
|
20 |
-
if __name__ == "__main__":
|
21 |
-
main()
|
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|