matthewwang16czap commited on
Commit
5d4dee1
1 Parent(s): be54301
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -2,10 +2,12 @@ import streamlit as st
2
  from transformers import pipeline
3
  import pandas as pd
4
 
 
5
  model_list = ["distilbert-base-uncased-finetuned-sst-2-english", "cardiffnlp/twitter-roberta-base-sentiment", "finiteautomata/bertweet-base-sentiment-analysis"]
6
  model_name = st.selectbox('Which model to predict?', model_list)
7
  text = st.text_input("text for sentiment analysis", value="I love you")
8
 
 
9
  if st.button('Run'):
10
  sentiment_pipeline = pipeline(model=model_name)
11
  result = sentiment_pipeline(text)
 
2
  from transformers import pipeline
3
  import pandas as pd
4
 
5
+ # load data
6
  model_list = ["distilbert-base-uncased-finetuned-sst-2-english", "cardiffnlp/twitter-roberta-base-sentiment", "finiteautomata/bertweet-base-sentiment-analysis"]
7
  model_name = st.selectbox('Which model to predict?', model_list)
8
  text = st.text_input("text for sentiment analysis", value="I love you")
9
 
10
+ # run to get result
11
  if st.button('Run'):
12
  sentiment_pipeline = pipeline(model=model_name)
13
  result = sentiment_pipeline(text)