Spaces:
Build error
Build error
import joblib | |
import streamlit as st | |
import os | |
import time | |
import pandas as pd | |
from PIL import Image | |
st.header("Emotional Predictive Model") | |
def main_sheet(n): | |
sheet=pd.read_excel(n) | |
return sheet | |
sheets=main_sheet('describe.xlsx') | |
def main_test(n): | |
test=pd.read_excel(n) | |
return test | |
test=main_test('test.xlsx') | |
def load_model(n): | |
model=joblib.load(n) | |
return model | |
model=load_model("EEGP.json") | |
good=[] | |
bad=[] | |
natural=[] | |
b=st.button("strat the test") | |
if b: | |
for i in range(1,30): | |
s=sheets.query(f"image=={i}") | |
chatbot_tiny_logo = Image.open(f"E:/samira/eeg/image/{i}.jpg") | |
st.image(chatbot_tiny_logo, caption=s["description"].values[0]) | |
d=test.sample(1) | |
X=d.iloc[:,:-1] | |
st.write(X) | |
emotion=model.predict(X) | |
st.write(emotion) | |
st.success("signal was recieved and analysed") | |
time.sleep(2) | |
if emotion=='POSITIVE': | |
good.append(s["description"].values[0]) | |
elif emotion=='NEGATIVE': | |
bad.append(s["description"].values[0]) | |
else: | |
natural.append(s["description"].values[0]) | |
else: | |
st.write("true the toggle") | |
st.header("Design guidline report") | |
new_data=pd.DataFrame(good) | |
st.write(good) |