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import json
|
| 5 |
+
import plotly.express as px
|
| 6 |
+
import plotly.graph_objects as go
|
| 7 |
+
from datetime import datetime
|
| 8 |
+
|
| 9 |
+
# Load the community dataset
|
| 10 |
+
@gr.cache
|
| 11 |
+
def load_community_data():
|
| 12 |
+
try:
|
| 13 |
+
dataset = load_dataset("RadicalNotionAI/modelatlas-community", split="train")
|
| 14 |
+
return dataset.to_pandas()
|
| 15 |
+
except Exception as e:
|
| 16 |
+
print(f"Error loading dataset: {e}")
|
| 17 |
+
return pd.DataFrame()
|
| 18 |
+
|
| 19 |
+
def create_overview_tab():
|
| 20 |
+
df = load_community_data()
|
| 21 |
+
|
| 22 |
+
if df.empty:
|
| 23 |
+
return gr.Markdown("## No data available yet. Be the first to contribute!")
|
| 24 |
+
|
| 25 |
+
# Basic stats
|
| 26 |
+
total_models = len(df)
|
| 27 |
+
organizations = df['organization'].nunique() if 'organization' in df else 0
|
| 28 |
+
latest_date = df['analyzed_at'].max() if 'analyzed_at' in df else 'Unknown'
|
| 29 |
+
|
| 30 |
+
stats_md = f'''
|
| 31 |
+
# π ModelAtlas Community Overview
|
| 32 |
+
|
| 33 |
+
**Community Stats:**
|
| 34 |
+
- πΊοΈ **Models Analyzed**: {total_models}
|
| 35 |
+
- π’ **Organizations**: {organizations}
|
| 36 |
+
- π
**Latest Analysis**: {latest_date[:10] if latest_date != 'Unknown' else 'Unknown'}
|
| 37 |
+
- π₯ **Contributors**: Coming soon
|
| 38 |
+
|
| 39 |
+
**Recent Models:**
|
| 40 |
+
'''
|
| 41 |
+
|
| 42 |
+
if not df.empty:
|
| 43 |
+
recent = df.nlargest(5, 'analyzed_at')[['model_id', 'organization', 'analyzed_at']]
|
| 44 |
+
for _, row in recent.iterrows():
|
| 45 |
+
stats_md += f"\n- `{row['model_id']}` - {row['organization']} ({row['analyzed_at'][:10]})"
|
| 46 |
+
|
| 47 |
+
return gr.Markdown(stats_md)
|
| 48 |
+
|
| 49 |
+
def create_models_tab():
|
| 50 |
+
df = load_community_data()
|
| 51 |
+
|
| 52 |
+
if df.empty:
|
| 53 |
+
return gr.DataFrame(pd.DataFrame({'message': ['No models available yet']}))
|
| 54 |
+
|
| 55 |
+
# Show public columns only (respect access control)
|
| 56 |
+
public_columns = ['model_id', 'organization', 'model_type', 'analyzed_at']
|
| 57 |
+
display_df = df[public_columns] if not df.empty else df
|
| 58 |
+
|
| 59 |
+
return gr.DataFrame(display_df)
|
| 60 |
+
|
| 61 |
+
def create_analytics_tab():
|
| 62 |
+
df = load_community_data()
|
| 63 |
+
|
| 64 |
+
if df.empty:
|
| 65 |
+
return gr.Markdown("## Analytics will appear when data is available")
|
| 66 |
+
|
| 67 |
+
# Organization analysis
|
| 68 |
+
if 'organization' in df and not df.empty:
|
| 69 |
+
org_counts = df['organization'].value_counts()
|
| 70 |
+
fig = px.bar(
|
| 71 |
+
x=org_counts.index,
|
| 72 |
+
y=org_counts.values,
|
| 73 |
+
title="Models by Organization",
|
| 74 |
+
labels={'x': 'Organization', 'y': 'Model Count'}
|
| 75 |
+
)
|
| 76 |
+
return gr.Plot(fig)
|
| 77 |
+
|
| 78 |
+
return gr.Markdown("## Analytics coming soon")
|
| 79 |
+
|
| 80 |
+
def create_access_tab():
|
| 81 |
+
return gr.Markdown('''
|
| 82 |
+
# π Access Control System
|
| 83 |
+
|
| 84 |
+
ModelAtlas implements tiered access to protect sensitive ablation research:
|
| 85 |
+
|
| 86 |
+
## Access Levels
|
| 87 |
+
|
| 88 |
+
### π PUBLIC
|
| 89 |
+
- View basic architectural data
|
| 90 |
+
- Access model comparisons and trends
|
| 91 |
+
- No ablation/intervention access
|
| 92 |
+
|
| 93 |
+
### π CONTRIBUTOR
|
| 94 |
+
- **Requirements**: 3+ contributions, 0.8+ quality score, 7+ days active
|
| 95 |
+
- **Access**: Basic intervention mapping
|
| 96 |
+
- **Elevation**: Automatic
|
| 97 |
+
|
| 98 |
+
### π₯ HERETIC
|
| 99 |
+
- **Requirements**: 10+ contributions, 0.9+ quality score, community vouching
|
| 100 |
+
- **Access**: Full ablation research capabilities
|
| 101 |
+
- **Elevation**: Manual approval
|
| 102 |
+
|
| 103 |
+
## How to Contribute
|
| 104 |
+
|
| 105 |
+
1. Install ModelAtlas: `pip install modelatlas`
|
| 106 |
+
2. Setup contribution: `python atlas.py contribute --setup`
|
| 107 |
+
3. Analyze models: `python model_test.py model/name`
|
| 108 |
+
4. Submit analyses: `python atlas.py contribute --submit`
|
| 109 |
+
5. Earn access through quality contributions!
|
| 110 |
+
|
| 111 |
+
## Request Access
|
| 112 |
+
|
| 113 |
+
Use the ModelAtlas CLI to request access upgrades:
|
| 114 |
+
```bash
|
| 115 |
+
python atlas.py contribute --request-access contributor
|
| 116 |
+
python atlas.py contribute --request-access heretic
|
| 117 |
+
```
|
| 118 |
+
''')
|
| 119 |
+
|
| 120 |
+
# Create the Gradio interface
|
| 121 |
+
with gr.Blocks(title="ModelAtlas Community Dashboard", theme=gr.themes.Soft()) as app:
|
| 122 |
+
gr.Markdown('''
|
| 123 |
+
# πΊοΈ ModelAtlas Community Dashboard
|
| 124 |
+
|
| 125 |
+
**Collaborative Intelligence for AI Model Architecture Analysis**
|
| 126 |
+
|
| 127 |
+
Welcome to the ModelAtlas community! This dashboard shows aggregated insights from
|
| 128 |
+
community-contributed model analyses. Join the community to unlock advanced features.
|
| 129 |
+
''')
|
| 130 |
+
|
| 131 |
+
with gr.Tabs():
|
| 132 |
+
with gr.TabItem("π Overview"):
|
| 133 |
+
overview_content = create_overview_tab()
|
| 134 |
+
|
| 135 |
+
with gr.TabItem("ποΈ Models"):
|
| 136 |
+
models_content = create_models_tab()
|
| 137 |
+
|
| 138 |
+
with gr.TabItem("π Analytics"):
|
| 139 |
+
analytics_content = create_analytics_tab()
|
| 140 |
+
|
| 141 |
+
with gr.TabItem("π Access & Contributing"):
|
| 142 |
+
access_content = create_access_tab()
|
| 143 |
+
|
| 144 |
+
gr.Markdown('''
|
| 145 |
+
---
|
| 146 |
+
*Built with ModelAtlas β’ [Documentation](https://github.com/your-org/ModelAtlas) β’ [CLI Tool](https://github.com/your-org/ModelAtlas)*
|
| 147 |
+
''')
|
| 148 |
+
|
| 149 |
+
if __name__ == "__main__":
|
| 150 |
+
app.launch()
|