Venustcs commited on
Commit
ec4900f
·
verified ·
1 Parent(s): 75c1c8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -9,11 +9,16 @@ st.write("Classification for 6 emotions: sadness, joy, love, anger, fear, surpri
9
  text = st.text_area("Enter the text to classify", "")
10
  # Perform text classification when the user clicks the "Classify" button
11
  if st.button("Classify"):
 
12
  # Perform text classification on the input text results = classifier(text)[0]
13
  # Display the classification result
14
- max_score = float('-inf')
15
  max_label = ''
16
  for result in results:
17
  if result['score'] > max_score:
18
- max_score = result['score'] max_label = result['label']
19
- st.write("Text:", text) st.write("Label:", max_label) st.write("Score:", max_score)
 
 
 
 
 
9
  text = st.text_area("Enter the text to classify", "")
10
  # Perform text classification when the user clicks the "Classify" button
11
  if st.button("Classify"):
12
+ results = classifier(text)[0]
13
  # Perform text classification on the input text results = classifier(text)[0]
14
  # Display the classification result
15
+ max_score = float('-inf')
16
  max_label = ''
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)