Spaces:
Sleeping
Sleeping
Download app.py from User-2468/Sentiment_Analyser: direct link, hf CLI and curl.
- Browser
- Download file 455 Bytes
-
https://huggingface.co/spaces/User-2468/Sentiment_Analyser/resolve/main/app.py
- Command line
-
hf download hf://spaces/User-2468/Sentiment_Analyser/app.py
-
curl -L -o app.py https://huggingface.co/spaces/User-2468/Sentiment_Analyser/resolve/main/app.py
455 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| sentiment_pipeline = pipeline("sentiment-analysis") | |
| st.title("Sentiment Analysis with HuggingFace Spaces") | |
| user_input = st.text_input("Enter a sentence to analyze its sentiment") | |
| if user_input: | |
| result = sentiment_pipeline(user_input) | |
| sentiment = result[0]["label"] | |
| confidence = result[0]["score"] | |
| st.write(f"Sentiment: {sentiment}") | |
| st.write(f"Confidence: {confidence:.2f}") |