Spaces:
Runtime error
Runtime error
base model test
Browse files
app.py
CHANGED
|
@@ -1,15 +1,22 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
|
|
|
| 4 |
text = st.text_area('enter some text!')
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
pipe = pipeline('sentiment-analysis')
|
| 5 |
text = st.text_area('enter some text!')
|
| 6 |
|
| 7 |
+
if text:
|
| 8 |
+
out = pipe(text)
|
| 9 |
+
st.json(out)
|
| 10 |
|
| 11 |
+
# text = st.text_area('enter some text!')
|
| 12 |
|
| 13 |
+
# classifier = pipeline("text-classification", model="hun3359/klue-bert-base-sentiment")
|
| 14 |
+
# preds = classifier(text, top_k=None)
|
| 15 |
|
| 16 |
+
# sorted_preds = sorted(preds, key=lambda x: x['score'], reverse=True)
|
| 17 |
+
|
| 18 |
+
# for item in sorted_preds:
|
| 19 |
+
# item['score'] = round(item['score'], 5)
|
| 20 |
+
|
| 21 |
+
# if text:
|
| 22 |
+
# st.json(sorted_preds)
|