import warnings import streamlit as st warnings.filterwarnings("ignore", category=UserWarning, module="streamlit") import pandas as pd import json import os from huggingface_hub import HfApi, login from streamlit_cookies_manager import EncryptedCookieManager st.set_page_config( page_title="Holistic AI - ML Verticals papers", page_icon="👋", layout='wide' ) def program(): st.title("Papers") dataset_name = "holistic-ai/mitigation_ml_bias_strategies" token = os.getenv("HF_TOKEN") api = HfApi() login(token) repo_path = api.snapshot_download(repo_id=dataset_name, repo_type="dataset") dirnames = [dirname for dirname in os.listdir(repo_path) if not dirname.startswith(".")] dirnames = sorted(dirnames, key=lambda x:len(x)) st.sidebar.title("Namespaces") selected_namespace = st.sidebar.selectbox("Select Namespace", dirnames) selected_paper_type = st.sidebar.selectbox("Select Paper Type", ['Metrics',"Mitigators"]) if selected_namespace: if selected_paper_type=='Metrics': with open(f'{repo_path}/{selected_namespace}/grouped_metrics.json') as file: data = json.load(file) elif selected_paper_type=='Mitigators': with open(f'{repo_path}/{selected_namespace}/grouped_mitigators.json') as file: data = json.load(file) task_names = list(data.keys()) st.sidebar.title("Tasks") selected_task = st.sidebar.selectbox("Select a Task", task_names) if selected_task: st.header(selected_task) results = data[selected_task] rec = {str(r['id']): r for r in results['recommendations']} for group in results['groups']: ids = [i.strip() for i in group['ids'].split(",")] selected_rec = [rec[i] for i in ids] selected_rec = pd.DataFrame(selected_rec) selected_rec['date'] = pd.to_datetime(selected_rec.apply(lambda x:x['metadata']['date'], axis=1)) selected_rec = selected_rec.sort_values(by='date', ascending=False).to_dict('records') rec2html = ''.join([f"""
{title}
{group['recommendation']}
Index | Paper | Year |
---|