Daulet9900 commited on
Commit
051f891
·
1 Parent(s): 4df4eb4

input text box and getting results

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -11,4 +11,17 @@ emotion_classifier = pipeline("text-classification", model=model_name)
11
  st.title("Emotion Classifier")
12
  st.write("""write down how your day went or what your mood is.
13
  On this space used model "bhadresh-savani/distilbert-base-uncased-emotion"
14
- """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  st.title("Emotion Classifier")
12
  st.write("""write down how your day went or what your mood is.
13
  On this space used model "bhadresh-savani/distilbert-base-uncased-emotion"
14
+ """)
15
+
16
+ # Input text box
17
+ input_text = st.text_area("Enter text to analyze emotions:", "")
18
+
19
+ if st.button("Classify Emotion"):
20
+ if input_text.strip() == "":
21
+ st.write("Please enter some text to classify.")
22
+ else:
23
+ # Get classification results
24
+ results = emotion_classifier(input_text)
25
+ st.subheader("Predicted Emotions:")
26
+ for result in results:
27
+ st.write(f"**{result['label']}**: {result['score']:.4f}")