Spaces:
Runtime error
Runtime error
Download app.py from madani/streamlit1: direct link, hf CLI and curl.
- Browser
- Download file 609 Bytes
-
https://huggingface.co/spaces/madani/streamlit1/resolve/main/app.py
- Command line
-
hf download hf://spaces/madani/streamlit1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/madani/streamlit1/resolve/main/app.py
609 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| # Create a Streamlit app | |
| st.title("Text Classification with Hugginface: sentiment analysis case") | |
| # Get user input | |
| text = st.text_input("Enter some text to classify:") | |
| #pipeline for sentiment analysis | |
| sentiment = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english") | |
| #Print the sentiment and the corresponding score when the button is clicked | |
| if st.button('Click to get the sentiment'): | |
| output = sentiment(text) | |
| st.write("The sentiment is ",output[0]['label'].lower(),' avec un score ', output[0]['score']) |