Madhumitha19 commited on
Commit
f2ada5a
1 Parent(s): 22ec88e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -16,10 +16,12 @@ with open('tokenizer.pkl', 'rb') as tokenizer_file:
16
  class_mapping = {"Angry": 0, "Sad": 1, "Joy": 2, "Surprise": 3}
17
  numerical_to_label = {v: k for k, v in class_mapping.items()}
18
 
19
- st.title('Model Deployment')
 
 
20
 
21
  # Text input for the user to enter a sequence
22
- user_input = st.text_input('Enter a sequence:')
23
 
24
  if st.button('Predict'):
25
  # Tokenize and pad the user input
@@ -29,8 +31,10 @@ if st.button('Predict'):
29
  # Make predictions
30
  prediction = lstm_model.predict(padded_sequence)
31
 
32
- # Display the predicted probabilities and labels
33
- st.write('Predicted Probabilities:')
34
  for i in range(len(prediction[0])):
35
  label = numerical_to_label[i]
36
- st.write(f'{label}: {prediction[0][i]}')
 
 
 
16
  class_mapping = {"Angry": 0, "Sad": 1, "Joy": 2, "Surprise": 3}
17
  numerical_to_label = {v: k for k, v in class_mapping.items()}
18
 
19
+ st.title('VibeConnect')
20
+
21
+
22
 
23
  # Text input for the user to enter a sequence
24
+ user_input = st.text_input('Enter a Text:')
25
 
26
  if st.button('Predict'):
27
  # Tokenize and pad the user input
 
31
  # Make predictions
32
  prediction = lstm_model.predict(padded_sequence)
33
 
34
+ threshold = 0.5
35
+ # Display the label
36
  for i in range(len(prediction[0])):
37
  label = numerical_to_label[i]
38
+ probability = prediction[0][i]
39
+ if probability > threshold:
40
+ st.write(f'{label}: {probability}')