awacke1 commited on
Commit
0096450
ยท
verified ยท
1 Parent(s): bb30d50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +190 -0
app.py CHANGED
@@ -22,3 +22,193 @@ st.markdown("""
22
 
23
  """)
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  """)
24
 
25
+ st.markdown("## The Evolution of AI")
26
+
27
+ # HTML and SVG for the animated diagram
28
+ html_content = """
29
+ <style>
30
+ .stage {
31
+ font-family: Arial, sans-serif;
32
+ font-size: 14px;
33
+ color: #333;
34
+ }
35
+ .level {
36
+ display: flex;
37
+ align-items: center;
38
+ margin-bottom: 10px;
39
+ }
40
+ .level svg {
41
+ margin-right: 10px;
42
+ }
43
+ .description {
44
+ flex-grow: 1;
45
+ }
46
+ </style>
47
+ <div class="stage">
48
+ <div class="level">
49
+ <svg width="30" height="30">
50
+ <circle cx="15" cy="15" r="10" fill="#3498db" />
51
+ <animate attributeName="r" from="10" to="12" dur="1s" repeatCount="indefinite" />
52
+ </svg>
53
+ <div class="description">๐Ÿ—ฃ๏ธ Level 1: Chatbots, AI with conversational language (Chatbots)</div>
54
+ </div>
55
+ <div class="level">
56
+ <svg width="30" height="30">
57
+ <rect x="5" y="5" width="20" height="20" fill="#2ecc71" />
58
+ <animate attributeName="width" from="20" to="22" dur="1s" repeatCount="indefinite" />
59
+ </svg>
60
+ <div class="description">๐Ÿง  Level 2: Reasoners, human-level problem-solving (Reasoners)</div>
61
+ </div>
62
+ <div class="level">
63
+ <svg width="30" height="30">
64
+ <polygon points="15,5 25,25 5,25" fill="#e74c3c" />
65
+ <animate attributeName="points" values="15,5 25,25 5,25; 14,4 24,24 4,24; 15,5 25,25 5,25" dur="1s" repeatCount="indefinite" />
66
+ </svg>
67
+ <div class="description">๐Ÿค– Level 3: Agents, systems that can take actions (Agents)</div>
68
+ </div>
69
+ <div class="level">
70
+ <svg width="30" height="30">
71
+ <circle cx="15" cy="15" r="10" fill="#f39c12" />
72
+ <animate attributeName="fill" values="#f39c12;#e67e22;#f39c12" dur="1s" repeatCount="indefinite" />
73
+ </svg>
74
+ <div class="description">๐Ÿ’ก Level 4: Innovators, AI that can aid in invention (Innovators)</div>
75
+ </div>
76
+ <div class="level">
77
+ <svg width="30" height="30">
78
+ <rect x="5" y="5" width="20" height="20" fill="#9b59b6" />
79
+ <animate attributeName="height" from="20" to="22" dur="1s" repeatCount="indefinite" />
80
+ </svg>
81
+ <div class="description">๐Ÿข Level 5: Organizations, AI that can do the work of an organization (Organizations)</div>
82
+ </div>
83
+ </div>
84
+ """
85
+
86
+ # Display the HTML content with SVG animations in Streamlit
87
+ st.components.v1.html(html_content, height=300)
88
+
89
+ # The markdown table for reference
90
+ st.markdown("""
91
+ | Level | Description | Create & Model | Python ๐Ÿ | HTML5 ๐Ÿ•ธ๏ธ | JavaScript ๐Ÿ“œ |
92
+ |-------|-------------|----------------|-----------|-----------|--------------|
93
+ | Level 1 | ๐Ÿ—ฃ๏ธ Chatbots, AI with conversational language | Chatbots | `import chatbot` | `<script src="chatbot.js"></script>` | `const chatbot = new Chatbot();` |
94
+ | Level 2 | ๐Ÿง  Reasoners, human-level problem-solving | Reasoners | `import reasoner` | `<script src="reasoner.js"></script>` | `const reasoner = new Reasoner();` |
95
+ | Level 3 | ๐Ÿค– Agents, systems that can take actions | Agents | `import agent` | `<script src="agent.js"></script>` | `const agent = new Agent();` |
96
+ | Level 4 | ๐Ÿ’ก Innovators, AI that can aid in invention | Innovators | `import innovator` | `<script src="innovator.js"></script>` | `const innovator = new Innovator();` |
97
+ | Level 5 | ๐Ÿข Organizations, AI that can do the work of an organization | Organizations | `import organization` | `<script src="organization.js"></script>` | `const organization = new Organization();` |
98
+ """)
99
+
100
+
101
+
102
+ import streamlit as st
103
+
104
+ st.set_page_config(page_title="AI Evolution", layout="wide")
105
+
106
+ st.markdown("""
107
+ # The Evolution of AI
108
+
109
+ This interactive diagram shows the stages of AI development, from simple chatbots to complex organizational systems.
110
+ """)
111
+
112
+ # Embed the JavaScript animation
113
+ st.components.v1.html("""
114
+ <div id="ai-evolution-diagram" style="width: 100%; height: 500px;"></div>
115
+ <script src="https://d3js.org/d3.v7.min.js"></script>
116
+ <script>
117
+ const width = document.getElementById('ai-evolution-diagram').clientWidth;
118
+ const height = 500;
119
+ const svg = d3.select("#ai-evolution-diagram")
120
+ .append("svg")
121
+ .attr("width", width)
122
+ .attr("height", height);
123
+
124
+ const stages = [
125
+ { level: 1, name: "Chatbots", icon: "๐Ÿ—ฃ๏ธ" },
126
+ { level: 2, name: "Problem Solvers", icon: "๐Ÿง " },
127
+ { level: 3, name: "Autonomous Agents", icon: "๐Ÿค–" },
128
+ { level: 4, name: "Inventive Systems", icon: "๐Ÿ’ก" },
129
+ { level: 5, name: "Organizations", icon: "๐Ÿข" }
130
+ ];
131
+
132
+ const xScale = d3.scaleLinear()
133
+ .domain([1, 5])
134
+ .range([50, width - 50]);
135
+
136
+ const yScale = d3.scaleLinear()
137
+ .domain([0, 1])
138
+ .range([height - 50, 50]);
139
+
140
+ // Draw connecting lines
141
+ svg.selectAll("line")
142
+ .data(stages.slice(0, -1))
143
+ .enter()
144
+ .append("line")
145
+ .attr("x1", d => xScale(d.level))
146
+ .attr("y1", yScale(0.5))
147
+ .attr("x2", d => xScale(d.level + 1))
148
+ .attr("y2", yScale(0.5))
149
+ .attr("stroke", "#ccc")
150
+ .attr("stroke-width", 2);
151
+
152
+ // Create groups for each stage
153
+ const stageGroups = svg.selectAll("g")
154
+ .data(stages)
155
+ .enter()
156
+ .append("g")
157
+ .attr("transform", d => `translate(${xScale(d.level)}, ${yScale(0.5)})`);
158
+
159
+ // Add circles
160
+ stageGroups.append("circle")
161
+ .attr("r", 30)
162
+ .attr("fill", "#f0f0f0")
163
+ .attr("stroke", "#333")
164
+ .attr("stroke-width", 2);
165
+
166
+ // Add icons
167
+ stageGroups.append("text")
168
+ .attr("text-anchor", "middle")
169
+ .attr("dy", "0.3em")
170
+ .attr("font-size", "24px")
171
+ .text(d => d.icon);
172
+
173
+ // Add labels
174
+ stageGroups.append("text")
175
+ .attr("text-anchor", "middle")
176
+ .attr("dy", "3em")
177
+ .text(d => d.name);
178
+
179
+ // Animation
180
+ function animateStages() {
181
+ stageGroups.transition()
182
+ .duration(1000)
183
+ .attr("transform", (d, i) => `translate(${xScale(d.level)}, ${yScale(0.5 + Math.sin(i) * 0.1)})`)
184
+ .on("end", animateStages);
185
+ }
186
+
187
+ animateStages();
188
+ </script>
189
+ """, height=550)
190
+
191
+ # Display the markdown tables
192
+ st.markdown("""
193
+ ## Stages of AI Development
194
+
195
+ | Level | Stage | Description | Creation/Model |
196
+ |-------|-------|-------------|----------------|
197
+ | 1 | ๐Ÿ—ฃ๏ธ Data Collection | Gather and preprocess datasets for language models | ๐Ÿ’ฌ Chatbots |
198
+ | 2 | ๐Ÿง  Model Architecture | Design neural networks for basic reasoning tasks | ๐Ÿงฎ Problem Solvers |
199
+ | 3 | ๐Ÿค– Algorithm Implementation | Develop action-oriented systems using Python/TensorFlow | ๐ŸŽฎ Autonomous Agents |
200
+ | 4 | ๐Ÿ’ก Creative AI | Build models capable of generating novel solutions (e.g. GPT, DALL-E) | ๐ŸŽจ Inventive Systems |
201
+ | 5 | ๐Ÿข Full-Stack AI Systems | Create end-to-end AI solutions with HTML5/JS frontends and distributed backends | ๐Ÿ—๏ธ Organizations |
202
+
203
+ ## AI Development Tools
204
+
205
+ | Level | Description | Create & Model | Python ๐Ÿ | HTML5 ๐Ÿ•ธ๏ธ | JavaScript ๐Ÿ“œ |
206
+ |-------|-------------|----------------|-----------|-----------|--------------|
207
+ | Level 1 | ๐Ÿ—ฃ๏ธ Chatbots, AI with conversational language | Chatbots | `import chatbot` | `<script src="chatbot.js"></script>` | `const chatbot = new Chatbot();` |
208
+ | Level 2 | ๐Ÿง  Reasoners, human-level problem-solving | Reasoners | `import reasoner` | `<script src="reasoner.js"></script>` | `const reasoner = new Reasoner();` |
209
+ | Level 3 | ๐Ÿค– Agents, systems that can take actions | Agents | `import agent` | `<script src="agent.js"></script>` | `const agent = new Agent();` |
210
+ | Level 4 | ๐Ÿ’ก Innovators, AI that can aid in invention | Innovators | `import innovator` | `<script src="innovator.js"></script>` | `const innovator = new Innovator();` |
211
+ | Level 5 | ๐Ÿข Organizations, AI that can do the work of an organization | Organizations | `import organization` | `<script src="organization.js"></script>` | `const organization = new Organization();` |
212
+ """)
213
+
214
+