Spaces:
Sleeping
Sleeping
Madhumitha19
commited on
Commit
•
f2ada5a
1
Parent(s):
22ec88e
Update app.py
Browse files
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('
|
|
|
|
|
20 |
|
21 |
# Text input for the user to enter a sequence
|
22 |
-
user_input = st.text_input('Enter a
|
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 |
-
|
33 |
-
|
34 |
for i in range(len(prediction[0])):
|
35 |
label = numerical_to_label[i]
|
36 |
-
|
|
|
|
|
|
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}')
|