Samiraghafari commited on
Commit
6b413dd
1 Parent(s): ba74e6f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -0
app.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import streamlit as st
3
+ import os
4
+ import time
5
+ import pandas as pd
6
+ from PIL import Image
7
+
8
+ st.header("Emotional Predictive Model")
9
+ @st.cache_data
10
+ def main_sheet(n):
11
+ sheet=pd.read_excel(n)
12
+ return sheet
13
+ sheets=main_sheet('describe.xlsx')
14
+
15
+ @st.cache_data
16
+ def main_test(n):
17
+ test=pd.read_excel(n)
18
+ return test
19
+
20
+ test=main_test('test.xlsx')
21
+
22
+ @st.cache_resource
23
+ def load_model(n):
24
+ model=joblib.load(n)
25
+ return model
26
+
27
+ model=load_model("EEGP.json")
28
+ good=[]
29
+ bad=[]
30
+ natural=[]
31
+ b=st.button("strat the test")
32
+ if b:
33
+ for i in range(1,30):
34
+ s=sheets.query(f"image=={i}")
35
+ chatbot_tiny_logo = Image.open(f"E:/samira/eeg/image/{i}.jpg")
36
+ st.image(chatbot_tiny_logo, caption=s["description"].values[0])
37
+ d=test.sample(1)
38
+ X=d.iloc[:,:-1]
39
+ st.write(X)
40
+
41
+ emotion=model.predict(X)
42
+ st.write(emotion)
43
+ st.success("signal was recieved and analysed")
44
+ time.sleep(2)
45
+ if emotion=='POSITIVE':
46
+ good.append(s["description"].values[0])
47
+ elif emotion=='NEGATIVE':
48
+ bad.append(s["description"].values[0])
49
+ else:
50
+ natural.append(s["description"].values[0])
51
+
52
+ else:
53
+ st.write("true the toggle")
54
+
55
+
56
+
57
+ st.header("Design guidline report")
58
+ new_data=pd.DataFrame(good)
59
+ st.write(good)