Spaces:
Runtime error
Runtime error
dahongj
commited on
Commit
•
8cdbe40
1
Parent(s):
f703550
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import streamlit as st
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
def bertweet(data):
|
6 |
+
specific_model = pipeline(model="finiteautomata/bertweet-base-sentiment-analysis")
|
7 |
+
print(specific_model(data))
|
8 |
+
|
9 |
+
def getSent(data, model):
|
10 |
+
if(model == 'Bertweet'):
|
11 |
+
bertweet(data)
|
12 |
+
|
13 |
+
|
14 |
+
def rendPage():
|
15 |
+
st.title("Sentiment Analysis")
|
16 |
+
userText = st.text_input('User Input', "Hope you are having a great day!")
|
17 |
+
st.text("")
|
18 |
+
type = st.selectbox(
|
19 |
+
'Choose your model',
|
20 |
+
('Bertweet','Roberta'))
|
21 |
+
st.text("")
|
22 |
+
|
23 |
+
if st.button('Calculate'):
|
24 |
+
if(userText!="" and type != None):
|
25 |
+
st.text
|
26 |
+
getSent(userText,type)
|
27 |
+
|
28 |
+
rendPage()
|