Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,18 +13,18 @@ text = st.text_area("Enter the text to classify", "")
|
|
| 13 |
|
| 14 |
# Perform text classification when the user clicks the "Classify" button
|
| 15 |
if st.button("Classify"):
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 13 |
|
| 14 |
# Perform text classification when the user clicks the "Classify" button
|
| 15 |
if st.button("Classify"):
|
| 16 |
+
# Perform text classification on the input text
|
| 17 |
+
results = classifier(text)[0]
|
| 18 |
+
|
| 19 |
+
# Display the classification result
|
| 20 |
+
max_score = float('-inf')
|
| 21 |
+
max_label = ''
|
| 22 |
+
|
| 23 |
+
for result in results:
|
| 24 |
+
if result['score'] > max_score:
|
| 25 |
+
max_score = result['score']
|
| 26 |
+
max_label = result['label']
|
| 27 |
+
|
| 28 |
+
st.write("Text:", text)
|
| 29 |
+
st.write("Label:", max_label)
|
| 30 |
+
st.write("Score:", max_score)
|