Spaces:
Sleeping
Sleeping
Download app.py from Yong-Sik/basic-sentiment-classifier: direct link, hf CLI and curl.
- Browser
- Download file 362 Bytes
-
https://huggingface.co/spaces/Yong-Sik/basic-sentiment-classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/Yong-Sik/basic-sentiment-classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Yong-Sik/basic-sentiment-classifier/resolve/main/app.py
362 Bytes
| import streamlit as | |
| from transformers import pipeline | |
| st.title("Hugging Face Demo") | |
| text = st.text_input("Enter text to analyze") | |
| st.cache_resource | |
| def get_model(): | |
| return pipeline("sentiment-analysis") | |
| model = get_model() | |
| if text: | |
| result = model(text) | |
| st.write("Sentiment: ", result[0]["label"]) | |
| st.write("Confidence: ", result[0]["score"]) |