kya5 commited on
Commit
9782d85
1 Parent(s): 2d6e1b0
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ st.title('Sentiment Analysis App')
5
+ text = st.text_input(' ')
6
+
7
+ mname = st.selectbox(
8
+ 'Select a pre-trained model',
9
+ ['distilbert-base-uncased', 'distilbert-base-cased', 'bert-base-uncased', 'bert-base-cased',
10
+ 'cardiffnlp/twitter-roberta-base-sentiment-latest',
11
+ 'cardiffnlp/twitter-xlm-roberta-base-sentiment',
12
+ 'j-hartmann/emotion-english-distilroberta-base',
13
+ 'ProsusAI/finbert'
14
+ ]
15
+ )
16
+
17
+ if st.button('Analyze Sentiment'):
18
+ model = pipeline('sentiment-analysis', model=mname)
19
+ result = model(text)[0]
20
+ st.write(f'Sentiment: {result["label"]}')
21
+ st.write(f'Score: {result["score"]}')