Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from transformers import pipeline | |
| #Load model from HF | |
| clf = pipeline('sentiment-analysis') | |
| #Create Streamlit app | |
| st.title('Sentiment Analysis') | |
| st.write('Enter a text and we will predict its sentiment!') | |
| #Add text box | |
| txt_input = st.text_input('Enter text here:') | |
| #When text is entered, run model | |
| if st.button('Submit'): | |
| #Predict the sentiment using HF model | |
| sentiment = clf(txt_input)[0]['label'] | |
| #Display prediction | |
| st.write(f'Sentiment: {sentiment}') |