Download app.py from joelorellana/basic-sentiment-classifier: direct link, hf CLI and curl.
- Browser
- Download file 368 Bytes
-
https://huggingface.co/spaces/joelorellana/basic-sentiment-classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/joelorellana/basic-sentiment-classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/joelorellana/basic-sentiment-classifier/resolve/main/app.py
368 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| st.title("Hugging Face Demo") | |
| text = st.text_input("Enter text to analyze: ") | |
| 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"]) |