IsabelLoci commited on
Commit
4ed96bc
·
verified ·
1 Parent(s): fd80914

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -6,16 +6,13 @@ classifier = pipeline("sentiment-analysis", model="michellejieli/emotion_text_cl
6
  st.title("Emotion in Text Classifier")
7
  st.write("Enter any sentence, and the model will predict the expressed emotion in it!")
8
 
9
- user_input = st.text_area("Input Text", "Type your prompt here...")
10
 
11
- if st.button("Analyze Emotion"):
12
- if user_input.strip():
13
  result = classifier(user_input)
14
  emotion = result[0]['label']
15
  score = result[0]['score']
16
 
17
  st.write(f"**Predicted Emotion:** {emotion}")
18
- st.write(f"**Confidence Score:** {score:.4f}")
19
- else:
20
- st.write("Please enter some text to analyze.")
21
 
 
6
  st.title("Emotion in Text Classifier")
7
  st.write("Enter any sentence, and the model will predict the expressed emotion in it!")
8
 
9
+ user_input = st.text_area("Type your prompt here.", "...")
10
 
11
+ if st.button("Predict Emotion"):
 
12
  result = classifier(user_input)
13
  emotion = result[0]['label']
14
  score = result[0]['score']
15
 
16
  st.write(f"**Predicted Emotion:** {emotion}")
17
+ st.write(f"**Confidence Score:** {score:.2f}")
 
 
18