Download app.py from aiXpert/streamlit: direct link, hf CLI and curl.
- Browser
- Download file 523 Bytes
-
https://huggingface.co/spaces/aiXpert/streamlit/resolve/main/app.py
- Command line
-
hf download hf://spaces/aiXpert/streamlit/app.py
-
curl -L -o app.py https://huggingface.co/spaces/aiXpert/streamlit/resolve/main/app.py
523 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| sentiment_pipeline = pipeline("sentiment-analysis") | |
| st.title("Sentiment Analysis") | |
| st.write("Enter a sentence to analyze its sentiment:") | |
| user_input = st.text_input("userinput") | |
| 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}") | |
| # x = st.slider('Select a value') | |
| # st.write(x, 'squared is', x * x) |