File size: 1,455 Bytes
bacc400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# -*- coding: utf-8 -*-
"""dashboard

Automatically generated by Colab.

Original file is located at
    https://colab.research.google.com/drive/1yT5Jix3VrdcKCeSgH-Gt-NSJnfHzX42H
"""

# πŸ“Š Streamlit Dashboard Code (Save as `dashboard.py`)

import streamlit as st
import pandas as pd
import os

st.title("πŸ“Š Mental Health Datasets Comparison Dashboard")

# Use absolute path if needed, fallback to local folder
results_dir = os.path.abspath("EDA_results")
dataset_dirs = [f for f in os.listdir(results_dir) if os.path.isdir(os.path.join(results_dir, f))]

for ds in dataset_dirs:
    st.subheader(f"πŸ“ Dataset: {ds}")
    ds_path = os.path.join(results_dir, ds)

    col1, col2 = st.columns(2)

    with col1:
        plot1 = os.path.join(ds_path, "class_balance_plot.png")
        plot2 = os.path.join(ds_path, "avg_text_length_plot.png")
        if os.path.exists(plot1):
            st.image(plot1, caption="Class Balance")
        if os.path.exists(plot2):
            st.image(plot2, caption="Avg Text Length by Label")

    with col2:
        wc = os.path.join(ds_path, "wordcloud.png")
        if os.path.exists(wc):
            st.image(wc, caption="Word Cloud")

    entropy_path = os.path.join(ds_path, "entropy.csv")
    if os.path.exists(entropy_path):
        entropy = pd.read_csv(entropy_path)
        if 'entropy' in entropy.columns:
            st.metric(label="πŸ”€ Entropy (Label Diversity)", value=round(entropy['entropy'][0], 3))