ortal12345's picture
.
26b72fd verified
# -*- 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))