Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer, TextClassificationPipeline
|
3 |
import operator
|
4 |
-
import
|
5 |
|
6 |
def get_sentiment(out):
|
7 |
d = dict()
|
@@ -28,7 +28,8 @@ text = st.text_area(f'Ciao! This app uses {model_name}.\nEnter your text to tes
|
|
28 |
if text:
|
29 |
out = pipe(text)
|
30 |
df = get_sentiment(out[0])
|
31 |
-
fig =
|
|
|
32 |
|
33 |
st.pyplot(fig)
|
34 |
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer, TextClassificationPipeline
|
3 |
import operator
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
|
6 |
def get_sentiment(out):
|
7 |
d = dict()
|
|
|
28 |
if text:
|
29 |
out = pipe(text)
|
30 |
df = get_sentiment(out[0])
|
31 |
+
fig, ax = plt.subplots()
|
32 |
+
ax.bar(df.index, df[0])
|
33 |
|
34 |
st.pyplot(fig)
|
35 |
|