CoolFace
Apppublic

suryak004/FUN

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
app.py21 linesDownload Raw Back to root
1import streamlit as st2from transformers import pipeline3from textblob import TextBlob4 5pipe = pipeline('sentiment-analysis')6st.title("Sentiment Analysis")7 8st.subheader("Which framework would you like to use for sentiment analysis?")9option = st.selectbox('Choose Framework:',('Transformers', 'TextBlob')) # option is stored in this variable10 11st.subheader("Enter the text you want to analyze")12text = st.text_input('Enter text:') # text is stored in this variable13 14if option == 'Transformers':15    out = pipe(text)16else:17    out = TextBlob(text)18    out = out.sentiment19    20st.write("Sentiment of Text: ")21st.write(out)