File size: 1,593 Bytes
b6ed202
 
 
0d46d77
b6ed202
 
 
 
 
 
67becf0
b6ed202
 
 
 
67becf0
b6ed202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb019c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pandas as pd
import numpy as np
import json

from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models import load_model

import streamlit as st

with open("tokenizer_cnnlstm.json", 'r') as tokenizer_file:
    word_index = json.load(tokenizer_file)
    tokenizer = Tokenizer(num_words=100000)
    tokenizer.word_index = word_index

model = load_model("model2.h5")

classes = ['ADHD', 'OCD', 'Aspergers', 'Depression', 'PTSD']

st.markdown("## Mental Health Prediction 😌 - **Beta**")

st.divider()

text = st.text_area("Enter transcript:", height=200) 

if st.button("Predict"):
    sequence = tokenizer.texts_to_sequences([text])
    sequence = pad_sequences(sequence, maxlen=100)

    prediction = model.predict(sequence)
    predicted_class = classes[np.argmax(prediction)]
    
    st.write("**πŸ‘‰ I think you're talking about:**", predicted_class)

    prediction_flat = prediction.flatten()

    
    data = pd.DataFrame({
    'Category': classes,
    'Values': prediction_flat})
    
    st.bar_chart(data.set_index('Category'))



st.divider()

st.markdown("### πŸ›‘ Please give a context length of atleast 100 words for the best results")
st.markdown("## Disclaimer:")
st.markdown("""This model is not a substitute for professional medical advice. The predictions made by this model are based on a sample dataset and may not be accurate for all individuals. If you are concerned about your mental health, please 
            consult witha qualified healthcare professional.""")