LunaYi commited on
Commit
a3a8b1d
·
1 Parent(s): 0203cab
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -1,4 +1,15 @@
1
  import streamlit as st
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from transformers import pipeline
3
 
4
+ text = st.text_area('enter some text!')
5
+
6
+ classifier = pipeline("text-classification", model="hun3359/klue-bert-base-sentiment")
7
+ preds = classifier(text, top_k=None)
8
+
9
+ sorted_preds = sorted(preds, key=lambda x: x['score'], reverse=True)
10
+
11
+ for item in sorted_preds:
12
+ item['score'] = round(item['score'], 5)
13
+
14
+ if text:
15
+ st.json(sorted_preds)