ruchitoshniwal commited on
Commit
7c1f322
โ€ข
1 Parent(s): 37c81f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -8,9 +8,9 @@ from transformers import pipeline
8
 
9
  # Load pipeline
10
  pipe_lr = joblib.load(open("emotion_detector_pipe_lr.pkl","rb"))
11
- emoroberta_emotion_classifier = pipeline(
12
- "text-classification", model="arpanghoshal/EmoRoBERTa", return_all_scores=True
13
- )
14
 
15
  # Emojis
16
  emotions_emoji_dict = {"anger":"๐Ÿ˜ ","disgust":"๐Ÿคฎ", "fear":"๐Ÿ˜จ๐Ÿ˜ฑ", "joy":"๐Ÿค—", "neutral":"๐Ÿ˜", "sadness":"๐Ÿ˜”", "shame":"๐Ÿ˜ณ", "surprise":"๐Ÿ˜ฎ"}
@@ -62,19 +62,19 @@ def main():
62
 
63
  st.subheader("Predictions from EmoRoBERTa - BERT based pre-trained model (28 emotions)")
64
 
65
- col3,col4 = st.columns(2)
66
- emotion_dataframe_emoroberta, predicted_emotion_emoroberta, prediction_probability_emoroberta = predict_emotions_and_score_emoroberta(raw_text)
67
- with col3:
68
- st.success("Emotion")
69
- st.write(predicted_emotion_emoroberta)
70
-
71
- with col4:
72
- st.success("Emotion Score")
73
- st.write("{:.4f}".format(np.max(prediction_probability_emoroberta)))
74
- st.success("Prediction Probability")
75
- emotion_dataframe_emoroberta.columns = ["emotions","probability"]
76
- fig = alt.Chart(emotion_dataframe_emoroberta).mark_bar().encode(y=alt.Y('emotions', sort='-x'),x='probability',color='emotions')
77
- st.altair_chart(fig,use_container_width=True)
78
 
79
  if __name__ == '__main__':
80
  main()
 
8
 
9
  # Load pipeline
10
  pipe_lr = joblib.load(open("emotion_detector_pipe_lr.pkl","rb"))
11
+ #emoroberta_emotion_classifier = pipeline(
12
+ # "text-classification", model="arpanghoshal/EmoRoBERTa", return_all_scores=True
13
+ #)
14
 
15
  # Emojis
16
  emotions_emoji_dict = {"anger":"๐Ÿ˜ ","disgust":"๐Ÿคฎ", "fear":"๐Ÿ˜จ๐Ÿ˜ฑ", "joy":"๐Ÿค—", "neutral":"๐Ÿ˜", "sadness":"๐Ÿ˜”", "shame":"๐Ÿ˜ณ", "surprise":"๐Ÿ˜ฎ"}
 
62
 
63
  st.subheader("Predictions from EmoRoBERTa - BERT based pre-trained model (28 emotions)")
64
 
65
+ # col3,col4 = st.columns(2)
66
+ # emotion_dataframe_emoroberta, predicted_emotion_emoroberta, prediction_probability_emoroberta = predict_emotions_and_score_emoroberta(raw_text)
67
+ # with col3:
68
+ # st.success("Emotion")
69
+ # st.write(predicted_emotion_emoroberta)
70
+ #
71
+ # with col4:
72
+ # st.success("Emotion Score")
73
+ # st.write("{:.4f}".format(np.max(prediction_probability_emoroberta)))
74
+ # st.success("Prediction Probability")
75
+ # emotion_dataframe_emoroberta.columns = ["emotions","probability"]
76
+ # fig = alt.Chart(emotion_dataframe_emoroberta).mark_bar().encode(y=alt.Y('emotions', sort='-x'),x='probability',color='emotions')
77
+ # st.altair_chart(fig,use_container_width=True)
78
 
79
  if __name__ == '__main__':
80
  main()