WhoLetMeCook commited on
Commit
3fba00d
·
verified ·
1 Parent(s): 40223c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -16,12 +16,22 @@ def predict_emotion(text):
16
  return "Positive Emotion" if prediction == 1 else "Negative Emotion"
17
 
18
  # Streamlit app layout
19
- st.title("Emotion Classifier")
 
20
  st.write("Enter a sentence and ChefBERT will predict whether the emotion is positive (1) or negative (0).")
21
 
22
  # Input box
23
- user_input = st.text_input("Input Sentence", "")
 
 
 
 
24
 
25
- if user_input:
 
26
  result = predict_emotion(user_input)
27
  st.write("Prediction: ", result)
 
 
 
 
 
16
  return "Positive Emotion" if prediction == 1 else "Negative Emotion"
17
 
18
  # Streamlit app layout
19
+ st.title("ChefBERT Emotion Classifier") # This removes the heading link
20
+
21
  st.write("Enter a sentence and ChefBERT will predict whether the emotion is positive (1) or negative (0).")
22
 
23
  # Input box
24
+ placeholder = st.empty() # Placeholder for the input box
25
+
26
+ with placeholder.form("emotion_form"):
27
+ user_input = st.text_input("Input Sentence", "")
28
+ submit_button = st.form_submit_button(label="Submit")
29
 
30
+ # If there's user input, make the prediction and then clear the input
31
+ if submit_button and user_input:
32
  result = predict_emotion(user_input)
33
  st.write("Prediction: ", result)
34
+
35
+ # Clear the input field after prediction
36
+ placeholder.empty()
37
+ placeholder.text_input("Input Sentence", "")