Spaces:
Running
Running
model
Browse files
app.py
CHANGED
@@ -1,4 +1,15 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|