billusanda007 commited on
Commit
b6ed202
β€’
1 Parent(s): 906581a

Upload 4 files

Browse files
Files changed (4) hide show
  1. model2.h5 +3 -0
  2. model_ui.py +50 -0
  3. requirements.txt +3 -0
  4. tokenizer_cnnlstm.json +0 -0
model2.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:678b4c76a08d15abce63e38b92c8152fbe8d0ba8130afa254b8a2cdd8be005f2
3
+ size 165116144
model_ui.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+ import json
4
+ from tensorflow.keras.preprocessing.text import Tokenizer
5
+ from tensorflow.keras.preprocessing.sequence import pad_sequences
6
+ from tensorflow.keras.models import load_model
7
+
8
+ import streamlit as st
9
+
10
+ with open("./Model/tokenizer_cnnlstm.json", 'r') as tokenizer_file:
11
+ word_index = json.load(tokenizer_file)
12
+ tokenizer = Tokenizer(num_words=100000)
13
+ tokenizer.word_index = word_index
14
+
15
+ model = load_model("./Model/model2.h5")
16
+
17
+ classes = ['ADHD', 'OCD', 'Aspergers', 'Depression', 'PTSD']
18
+
19
+ st.markdown("## Mental Health Prediction 😌 - **Beta**")
20
+
21
+ st.divider()
22
+
23
+ text = st.text_area("Enter transcript:", height=200)
24
+
25
+ if st.button("Predict"):
26
+ sequence = tokenizer.texts_to_sequences([text])
27
+ sequence = pad_sequences(sequence, maxlen=100)
28
+
29
+ prediction = model.predict(sequence)
30
+ predicted_class = classes[np.argmax(prediction)]
31
+
32
+ st.write("**πŸ‘‰ I think you're talking about:**", predicted_class)
33
+
34
+ prediction_flat = prediction.flatten()
35
+
36
+
37
+ data = pd.DataFrame({
38
+ 'Category': classes,
39
+ 'Values': prediction_flat})
40
+
41
+ st.bar_chart(data.set_index('Category'))
42
+
43
+
44
+
45
+ st.divider()
46
+
47
+ st.markdown("### πŸ›‘ Please give a context length of atleast 100 words for the best results")
48
+ st.markdown("## Disclaimer:")
49
+ 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
50
+ consult witha qualified healthcare professional.""")
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ numpy==1.23.0
2
+ tensorflow==2.12.0
3
+ matplotlib
tokenizer_cnnlstm.json ADDED
The diff for this file is too large to render. See raw diff