Update app.py
Browse files
app.py
CHANGED
@@ -22,27 +22,15 @@ with st.form(key='tweet',clear_on_submit=False):
|
|
22 |
text=st.text_area('Copy and paste a tweet or type one',placeholder='I find it quite amusing how people ignore the effects of not taking the vaccine')
|
23 |
#Set examples
|
24 |
alt_text=st.selectbox("Can't Type? Select an Example below",('I hate the vaccines','Vaccines made from dead human tissues','Take the vaccines or regret the consequences','Covid is a Hoax','Making the vaccines is a huge step forward for humanity. Just take them'))
|
25 |
-
|
26 |
-
|
27 |
-
if submit:
|
28 |
-
#Check text
|
29 |
-
if text=="":
|
30 |
-
text=alt_text
|
31 |
-
st.write(f'input text is set to {text}')
|
32 |
-
else:
|
33 |
-
st.success('Text received',icon='✅')
|
34 |
-
#Select a model
|
35 |
-
exp=st.expander(label='Choose a model and Click Continue or go ahead and Click continue to use default')
|
36 |
-
models={'Roberta': 'Junr-syl/sentiments_analysis_Roberta',
|
37 |
'Bert': 'Junr-syl/sentiments_analysis_upgrade',
|
38 |
'Distilbert':'Junr-syl/sentiments_analysis_DISTILBERT'}
|
39 |
-
|
40 |
-
with exp:
|
41 |
model=st.selectbox('Which model would you want to Use?',('Distilbert','Bert','Roberta'))
|
42 |
-
|
|
|
|
|
43 |
selected_model=models[model]
|
44 |
-
#Click continue if no model is selected
|
45 |
-
Cont=st.button('Continue','Continue processing input')
|
46 |
|
47 |
#create columns to show outputs
|
48 |
col1,col2,col3=st.columns(3)
|
@@ -50,7 +38,14 @@ col1.write('<h2 style="font-size: 24px;"> Sentiment Emoji </h2>',unsafe_allow_ht
|
|
50 |
col2.write('<h2 style="font-size: 24px;"> How this user feels about the vaccine </h2>',unsafe_allow_html=True)
|
51 |
col3.write('<h2 style="font-size: 24px;"> Confidence of this prediction </h2>',unsafe_allow_html=True)
|
52 |
|
53 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
#import the model
|
55 |
pipe=pipeline(model=selected_model)
|
56 |
|
|
|
22 |
text=st.text_area('Copy and paste a tweet or type one',placeholder='I find it quite amusing how people ignore the effects of not taking the vaccine')
|
23 |
#Set examples
|
24 |
alt_text=st.selectbox("Can't Type? Select an Example below",('I hate the vaccines','Vaccines made from dead human tissues','Take the vaccines or regret the consequences','Covid is a Hoax','Making the vaccines is a huge step forward for humanity. Just take them'))
|
25 |
+
#Select a model
|
26 |
+
models={'Roberta': 'Junr-syl/sentiments_analysis_Roberta',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
'Bert': 'Junr-syl/sentiments_analysis_upgrade',
|
28 |
'Distilbert':'Junr-syl/sentiments_analysis_DISTILBERT'}
|
|
|
|
|
29 |
model=st.selectbox('Which model would you want to Use?',('Distilbert','Bert','Roberta'))
|
30 |
+
#Submit
|
31 |
+
submit=st.form_submit_button('Predict','Continue processing input')
|
32 |
+
|
33 |
selected_model=models[model]
|
|
|
|
|
34 |
|
35 |
#create columns to show outputs
|
36 |
col1,col2,col3=st.columns(3)
|
|
|
38 |
col2.write('<h2 style="font-size: 24px;"> How this user feels about the vaccine </h2>',unsafe_allow_html=True)
|
39 |
col3.write('<h2 style="font-size: 24px;"> Confidence of this prediction </h2>',unsafe_allow_html=True)
|
40 |
|
41 |
+
if submit:
|
42 |
+
#Check text
|
43 |
+
if text=="":
|
44 |
+
text=alt_text
|
45 |
+
st.write(f'input text is set to {text}')
|
46 |
+
else:
|
47 |
+
st.success('Text received',icon='✅')
|
48 |
+
|
49 |
#import the model
|
50 |
pipe=pipeline(model=selected_model)
|
51 |
|