trohrbaugh commited on
Commit
b86089e
Β·
verified Β·
1 Parent(s): 73c431a

Fix dependency issues - use simpler Gradio app

Browse files
Files changed (1) hide show
  1. app.py +114 -105
app.py CHANGED
@@ -1,150 +1,159 @@
1
  import gradio as gr
2
  import pandas as pd
3
- from datasets import load_dataset
4
  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()
 
1
  import gradio as gr
2
  import pandas as pd
 
3
  import json
 
 
4
  from datetime import datetime
5
 
6
+ # Simplified version to avoid dependency issues
7
+ def create_overview():
8
+ """Create overview content."""
9
  try:
10
+ # For now, return static content until dataset is populated
11
+ return """
12
+ # πŸ—ΊοΈ ModelAtlas Community Dashboard
13
+
14
+ **Status**: System is live and ready for contributions!
15
+
16
+ ## πŸ“Š Getting Started
17
+
18
+ This dashboard will show community analytics once model analyses are submitted.
19
+
20
+ ### πŸš€ How to Contribute
21
 
22
+ 1. **Install ModelAtlas CLI**:
23
+ ```bash
24
+ git clone https://github.com/your-org/ModelAtlas
25
+ cd ModelAtlas
26
+ ```
27
 
28
+ 2. **Setup contribution**:
29
+ ```bash
30
+ python atlas.py contribute --setup
31
+ ```
32
 
33
+ 3. **Analyze and submit models**:
34
+ ```bash
35
+ python model_test.py model/name
36
+ python atlas.py contribute --submit
37
+ ```
38
 
39
+ ### πŸ” Access Levels
 
40
 
41
+ - **PUBLIC**: View architectural insights
42
+ - **CONTRIBUTOR**: Access intervention mapping (3+ contributions)
43
+ - **HERETIC**: Full ablation research access (10+ contributions + approval)
 
 
44
 
45
+ ## πŸ“ˆ Coming Soon
 
46
 
47
+ - Community model browser
48
+ - Innovation timeline analytics
49
+ - Cross-organizational insights
50
+ - Technique adoption tracking
51
 
52
+ ---
53
 
54
+ **Ready to contribute?** Join the ModelAtlas community and help build collaborative AI research intelligence!
55
+ """
56
+ except Exception as e:
57
+ return f"Loading... (System initializing: {str(e)})"
58
+
59
+ def create_models_browser():
60
+ """Create models browser content."""
61
+ return """
62
+ # πŸ—‚οΈ Model Browser
63
 
64
+ The community model browser will appear here once contributions are submitted.
 
65
 
66
+ **What you'll see:**
67
+ - Community-contributed model analyses
68
+ - Architectural comparisons
69
+ - Technique evolution tracking
70
+ - Cross-organizational insights
71
 
72
+ **Current Status**: Waiting for first contributions to populate the dataset.
73
+ """
74
 
75
+ def create_access_info():
76
+ """Create access control information."""
77
+ return """
78
+ # πŸ” Access Control System
79
 
80
+ ModelAtlas implements responsible tiered access for ablation research:
 
81
 
82
+ ## 🌍 PUBLIC Access
83
+ - βœ… View model architectures
84
+ - βœ… Compare model configurations
85
+ - βœ… Analyze technique adoption
86
+ - ❌ No ablation/intervention access
 
 
 
 
 
87
 
88
+ ## πŸ“Š CONTRIBUTOR Access
89
+ - βœ… All public features
90
+ - βœ… Basic intervention mapping
91
+ - βœ… Ablation compatibility analysis
92
 
93
+ **Requirements**: 3+ contributions, 0.8+ quality score, 7+ days active
 
 
94
 
95
+ ## πŸ”₯ HERETIC Access
96
+ - βœ… All contributor features
97
+ - βœ… Advanced ablation strategies
98
+ - βœ… Cross-model transfer analysis
99
+ - βœ… Strategic research methodologies
100
 
101
+ **Requirements**: 10+ contributions, 0.9+ quality score, manual approval + community vouching
102
 
103
+ ## πŸ›‘οΈ Why Access Control?
 
 
 
104
 
105
+ Ablation techniques are powerful research tools that require responsible handling:
 
 
 
106
 
107
+ - **Protects Innovation**: Keeps sensitive research within trusted community
108
+ - **Rewards Quality**: Contributors earn access through meaningful work
109
+ - **Builds Trust**: Community vouching creates networks of trusted researchers
110
+ - **Enables Progress**: Heretic community can advance boundaries responsibly
111
 
112
+ ## πŸš€ Getting Started
113
 
114
+ ```bash
115
+ # Check your current access level
116
+ python atlas.py contribute --status
 
 
117
 
118
+ # Request access upgrade
119
+ python atlas.py contribute --request-access contributor
120
+ python atlas.py contribute --request-access heretic
121
+ ```
122
 
123
+ Ready to join the community? Start contributing quality analyses today!
124
+ """
 
 
 
 
125
 
126
+ # Create the interface
127
+ with gr.Blocks(title="ModelAtlas Community Dashboard") as demo:
128
+ gr.Markdown("""
129
  # πŸ—ΊοΈ ModelAtlas Community Dashboard
130
 
131
  **Collaborative Intelligence for AI Model Architecture Analysis**
132
 
133
+ Welcome to the ModelAtlas community platform! This dashboard aggregates insights from
134
+ community-contributed model analyses with tiered access control for responsible research.
135
+ """)
136
 
137
  with gr.Tabs():
138
+ with gr.Tab("πŸ“Š Overview"):
139
+ overview_md = gr.Markdown(create_overview())
 
 
 
140
 
141
+ with gr.Tab("πŸ—‚οΈ Models"):
142
+ models_md = gr.Markdown(create_models_browser())
143
 
144
+ with gr.Tab("πŸ” Access & Contributing"):
145
+ access_md = gr.Markdown(create_access_info())
146
 
147
+ gr.Markdown("""
148
  ---
149
+
150
+ **Links:**
151
+ - πŸ“Š Dataset: [RadicalNotionAI/modelatlas-community](https://huggingface.co/datasets/RadicalNotionAI/modelatlas-community)
152
+ - πŸš€ Dashboard: [RadicalNotionAI/modelatlas-dashboard](https://huggingface.co/spaces/RadicalNotionAI/modelatlas-dashboard)
153
+ - πŸ’» CLI Tool: [ModelAtlas GitHub](https://github.com/your-org/ModelAtlas)
154
+
155
+ *Built with ModelAtlas - Architectural Intelligence for AI Research*
156
+ """)
157
 
158
  if __name__ == "__main__":
159
+ demo.launch()