Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
classifier = pipeline("text-classification", model="")
|
| 5 |
|
| 6 |
-
|
|
|
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
classifier = pipeline("text-classification", model="isom5240/bert-base-uncased-emotion")
|
| 5 |
|
| 6 |
+
st.title("Text Classification for you")
|
| 7 |
+
st.write("Classification for 6 emotions: sadness, joy, love, anger, fear, surprice")
|
| 8 |
|
| 9 |
+
text = st.text_area("Enter the text to classify", "")
|
| 10 |
+
|
| 11 |
+
if st.button("Classify"):
|
| 12 |
+
results = classifier(text)[0]
|
| 13 |
+
|
| 14 |
+
max_score = float("-tmf")
|
| 15 |
+
max_label = ""
|
| 16 |
+
|
| 17 |
+
for result in results:
|
| 18 |
+
if result["score"] = max_score:
|
| 19 |
+
max_score = result['score']
|
| 20 |
+
max_label = result['label']
|
| 21 |
+
|
| 22 |
+
st.write("Text:", text)
|
| 23 |
+
st.write("Label:", max_label)
|
| 24 |
+
st.write("Score:", max_score)
|