Ediashta/EmotionClassification
0
1import streamlit as st2import pandas as pd3import seaborn as sns4import matplotlib.pyplot as plt5import plotly.express as px6 7dist_df = pd.read_csv('./csv/distribution.csv')8 9 10st.set_page_config(11 page_title="Facial Emotion Classification",12 layout="wide",13 initial_sidebar_state="expanded",14)15 16def distribution():17 # distribution plot18 19 st.header("Image Distribution")20 21 fig = px.bar(dist_df, 22 x="label", y="count", 23 labels={"label": "Emotions", "count": "Image Count"}, 24 color="label", template="plotly_white")25 fig.update_layout(height=600)26 27 # Show the plot28 st.plotly_chart(fig, use_container_width=True)29 30 st.markdown('''31 32 ''')33 34def samples(): 35 st.header("Image Samples")36 37 sample_img = st.sidebar.selectbox(label="Select Emotion Sample", 38 options=["Angry", "Disgusted", "Fearful", "Happy", "Neutral", "Sad", "Surprised"])39 40 if sample_img == "Angry":41 st.image('./image/angry.png')42 st.markdown('''43 This emotion is usually characterized by feelings of anger, frustration, and dissatisfaction towards something perceived as threatening or hurtful.44 45 **Physical Signs:**46 47 * The outer part of the eyebrows is raised.48 * The eyes are usually narrowed and sharp.49 * The muscles around the mouth are tensed.50 ''')51 52 elif sample_img == "Disgusted":53 st.image('./image/disgusted.png')54 st.markdown('''55 This emotion is related to feelings of fear or being disturbed by something disliked or considered disgusting.56 57 **Physical Signs**:58 - The eyebrows are raised.59 - The upper eyelids are raised.60 - The nose is wrinkled.61 - Usually, the mouth is slightly tense and slightly raised.62 63 ''')64 65 elif sample_img == "Fearful":66 st.image('./image/fearful.png')67 st.markdown('''68 This emotion involves feelings of fear or anxiety due to the presence of a threat or danger.69 70 **Physical Signs**:71 - Widened eyes72 - Outer part of the eyebrows slightly lowered73 - Mouth usually slightly downturned74 - In this emotion, hands are often used to cover parts of the face.75 76 ''')77 78 elif sample_img == "Happy":79 st.image('./image/happy.png')80 st.markdown('''81 This emotion is usually characterized by feelings of joy, happiness, and contentment. Happy facial expressions include smiling, twinkling eyes, and a tendency to be open and friendly.82 83 **Physical Signs**:84 - Eyes appear sparkling85 - Mouth is smiling86 87 ''')88 89 elif sample_img == "Neutral":90 st.image('./image/neutral.png')91 st.markdown('''92 Neutral emotion indicates the absence of strong emotions or facial expressions that do not show intense feelings.93 94 Physical Signs in this expression are that each **facial feature appears not prominent**.95 96 ''')97 98 elif sample_img == "Sad":99 st.image('./image/sad.png')100 st.markdown('''101 This emotion involves feelings of sadness, disappointment, and loss.102 103 Physical Signs:104 - Eyebrows are usually furrowed.105 - Eyes become downcast or droopy.106 - The corners of the mouth slightly downturned.107 108 ''')109 110 elif sample_img == "Surprised":111 st.image('./image/surprised.png')112 st.markdown('''113 This emotion arises when someone experiences an unexpected event or receives surprising information.114 115 Physical Signs:116 - Eyebrows raise entirely.117 - Eyes widen.118 - Typically, the mouth opens.119 120 ''')121 122 st.subheader("Mean (Avg.) of Image")123 st.image('./image/mean.png')124 st.markdown('''125 By calculating the mean of image from each class, the following information is obtained:126 127 * The most prominent expressions are **Happy and Surprised**, easily identifiable from the characteristics of the mouth.128 * **Sad, Fearful, and Neutral** expressions are somewhat challenging to differentiate.129 * **Angry and Disgusted** expressions appear similar due to the characteristics of the eyebrows and mouth.130 131 ''')132 133if __name__ == "__main__":134 distribution()135 