vipra commited on
Commit
05a6ccd
·
verified ·
1 Parent(s): 9b2de70

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +799 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ai Data Analyst Pingax
3
- emoji: 💻
4
- colorFrom: green
5
- colorTo: green
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ai-data-analyst-pingax
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,799 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Data Analyst | Interactive Notebook</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+ <style>
11
+ .gradient-bg {
12
+ background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
13
+ }
14
+ .sidebar-item:hover {
15
+ background-color: rgba(255, 255, 255, 0.1);
16
+ transform: translateX(5px);
17
+ }
18
+ .code-cell {
19
+ border-left: 4px solid #6e8efb;
20
+ transition: all 0.3s ease;
21
+ }
22
+ .code-cell:hover {
23
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
24
+ }
25
+ .output-cell {
26
+ background-color: #f8f9fa;
27
+ border-left: 4px solid #4fd1c5;
28
+ }
29
+ .cm-editor {
30
+ height: auto;
31
+ font-size: 14px;
32
+ line-height: 1.5;
33
+ }
34
+ .cm-gutters {
35
+ background-color: #f8f9fa !important;
36
+ }
37
+ .cm-activeLineGutter {
38
+ background-color: #e9ecef !important;
39
+ }
40
+ .cm-activeLine {
41
+ background-color: #f1f3f5 !important;
42
+ }
43
+ .prompt-input:focus {
44
+ outline: none;
45
+ box-shadow: 0 0 0 2px rgba(110, 142, 251, 0.5);
46
+ }
47
+ .notebook-container {
48
+ scroll-behavior: smooth;
49
+ }
50
+ .cell-toolbar {
51
+ opacity: 0;
52
+ transition: opacity 0.2s ease;
53
+ }
54
+ .code-cell:hover .cell-toolbar {
55
+ opacity: 1;
56
+ }
57
+ .fade-in {
58
+ animation: fadeIn 0.3s ease-in;
59
+ }
60
+ @keyframes fadeIn {
61
+ from { opacity: 0; }
62
+ to { opacity: 1; }
63
+ }
64
+ </style>
65
+ </head>
66
+ <body class="bg-gray-50 font-sans">
67
+ <div class="flex h-screen overflow-hidden">
68
+ <!-- Sidebar -->
69
+ <div class="gradient-bg text-white w-64 flex-shrink-0 hidden md:flex flex-col">
70
+ <div class="p-4 flex items-center space-x-3">
71
+ <i class="fas fa-brain text-2xl"></i>
72
+ <h1 class="text-xl font-bold">AI Data Analyst</h1>
73
+ </div>
74
+ <div class="flex-1 overflow-y-auto">
75
+ <div class="p-4">
76
+ <div class="mb-6">
77
+ <h2 class="text-sm uppercase font-semibold mb-2 opacity-70">Main</h2>
78
+ <div class="space-y-1">
79
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200">
80
+ <i class="fas fa-tachometer-alt"></i>
81
+ <span>Dashboard</span>
82
+ </a>
83
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200 bg-white bg-opacity-10">
84
+ <i class="fas fa-book"></i>
85
+ <span>Notebooks</span>
86
+ </a>
87
+ </div>
88
+ </div>
89
+
90
+ <div class="mb-6">
91
+ <h2 class="text-sm uppercase font-semibold mb-2 opacity-70">Analysis Tools</h2>
92
+ <div class="space-y-1">
93
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('visualization')">
94
+ <i class="fas fa-chart-line"></i>
95
+ <span>Charts & Graphs</span>
96
+ </a>
97
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('manipulation')">
98
+ <i class="fas fa-filter"></i>
99
+ <span>Data Manipulation</span>
100
+ </a>
101
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('insights')">
102
+ <i class="fas fa-lightbulb"></i>
103
+ <span>Insights</span>
104
+ </a>
105
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('science')">
106
+ <i class="fas fa-flask"></i>
107
+ <span>Data Science</span>
108
+ </a>
109
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('reports')">
110
+ <i class="fas fa-file-alt"></i>
111
+ <span>Reports</span>
112
+ </a>
113
+ </div>
114
+ </div>
115
+
116
+ <div class="mb-6">
117
+ <h2 class="text-sm uppercase font-semibold mb-2 opacity-70">Datasets</h2>
118
+ <div class="space-y-1">
119
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200">
120
+ <i class="fas fa-database"></i>
121
+ <span>Browse Data</span>
122
+ </a>
123
+ <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200">
124
+ <i class="fas fa-upload"></i>
125
+ <span>Upload Data</span>
126
+ </a>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ <div class="p-4 border-t border-white border-opacity-10">
132
+ <div class="flex items-center space-x-3">
133
+ <div class="w-10 h-10 rounded-full bg-white bg-opacity-20 flex items-center justify-center">
134
+ <i class="fas fa-user"></i>
135
+ </div>
136
+ <div>
137
+ <div class="font-medium">John Doe</div>
138
+ <div class="text-xs opacity-70">Admin</div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ <!-- Main Content -->
145
+ <div class="flex-1 flex flex-col overflow-hidden">
146
+ <!-- Top Navigation -->
147
+ <header class="bg-white border-b border-gray-200 flex items-center justify-between p-4">
148
+ <div class="flex items-center space-x-4">
149
+ <button class="md:hidden text-gray-600">
150
+ <i class="fas fa-bars"></i>
151
+ </button>
152
+ <h1 class="text-xl font-bold text-gray-800">Interactive Analysis Notebook</h1>
153
+ </div>
154
+ <div class="flex items-center space-x-4">
155
+ <div class="flex space-x-2">
156
+ <button class="px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center space-x-2">
157
+ <i class="fas fa-save text-gray-600"></i>
158
+ <span>Save</span>
159
+ </button>
160
+ <button class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 flex items-center space-x-2">
161
+ <i class="fas fa-play"></i>
162
+ <span>Run All</span>
163
+ </button>
164
+ <button class="px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center space-x-2">
165
+ <i class="fas fa-file-export text-gray-600"></i>
166
+ <span>Export</span>
167
+ </button>
168
+ </div>
169
+ </div>
170
+ </header>
171
+
172
+ <!-- Tool Selection Panel -->
173
+ <div id="toolPanel" class="bg-white border-b border-gray-200 p-4 hidden">
174
+ <div class="flex items-center justify-between">
175
+ <h2 class="font-medium" id="toolTitle">Tool</h2>
176
+ <button onclick="hideToolPanel()" class="text-gray-500 hover:text-gray-700">
177
+ <i class="fas fa-times"></i>
178
+ </button>
179
+ </div>
180
+ <div id="toolContent" class="mt-3">
181
+ <!-- Tool content will be loaded here -->
182
+ </div>
183
+ </div>
184
+
185
+ <!-- Notebook Container -->
186
+ <main class="flex-1 overflow-y-auto notebook-container bg-white p-4" id="notebookContainer">
187
+ <!-- Welcome Cell -->
188
+ <div class="mb-6 bg-blue-50 border-l-4 border-blue-500 p-4 rounded-r-lg">
189
+ <h2 class="text-lg font-bold text-blue-800 mb-2">Welcome to your Interactive Analysis Notebook!</h2>
190
+ <p class="text-blue-700">This notebook combines the power of Python with AI assistance. You can write code directly or describe what you want in plain English and let the AI generate the code for you.</p>
191
+ </div>
192
+
193
+ <!-- Sample Data Load Cell -->
194
+ <div class="code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden">
195
+ <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center">
196
+ <div class="flex space-x-2">
197
+ <button class="text-gray-500 hover:text-gray-700" title="Run cell">
198
+ <i class="fas fa-play"></i>
199
+ </button>
200
+ <button class="text-gray-500 hover:text-gray-700" title="Add cell below">
201
+ <i class="fas fa-plus"></i>
202
+ </button>
203
+ </div>
204
+ <div class="flex space-x-2">
205
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell up">
206
+ <i class="fas fa-arrow-up"></i>
207
+ </button>
208
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell down">
209
+ <i class="fas fa-arrow-down"></i>
210
+ </button>
211
+ <button class="text-gray-500 hover:text-gray-700" title="Delete cell">
212
+ <i class="fas fa-trash"></i>
213
+ </button>
214
+ </div>
215
+ </div>
216
+ <div class="px-4 py-3">
217
+ <div class="font-mono text-sm bg-gray-800 text-gray-100 p-3 rounded-lg overflow-x-auto">
218
+ <span class="text-green-400"># Sample data loading</span><br>
219
+ <span class="text-blue-400">import</span> pandas <span class="text-blue-400">as</span> pd<br>
220
+ <span class="text-blue-400">import</span> numpy <span class="text-blue-400">as</span> np<br><br>
221
+ <span class="text-green-400"># Load sample sales data</span><br>
222
+ df = pd.read_csv(<span class="text-yellow-300">'sample_sales_data.csv'</span>)<br>
223
+ df.head()
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ <!-- Output Cell -->
229
+ <div class="output-cell rounded-lg mb-6 border border-gray-200 overflow-hidden fade-in">
230
+ <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center">
231
+ <span class="text-xs font-mono text-gray-500">Out[1]</span>
232
+ <button class="text-gray-500 hover:text-gray-700" title="Clear output">
233
+ <i class="fas fa-times"></i>
234
+ </button>
235
+ </div>
236
+ <div class="px-4 py-3 overflow-x-auto">
237
+ <table class="min-w-full border border-gray-200 text-sm">
238
+ <thead class="bg-gray-100">
239
+ <tr>
240
+ <th class="border px-2 py-1">Order ID</th>
241
+ <th class="border px-2 py-1">Product</th>
242
+ <th class="border px-2 py-1">Category</th>
243
+ <th class="border px-2 py-1">Quantity</th>
244
+ <th class="border px-2 py-1">Price</th>
245
+ <th class="border px-2 py-1">Order Date</th>
246
+ </tr>
247
+ </thead>
248
+ <tbody>
249
+ <tr>
250
+ <td class="border px-2 py-1">1001</td>
251
+ <td class="border px-2 py-1">Ultra HD TV</td>
252
+ <td class="border px-2 py-1">Electronics</td>
253
+ <td class="border px-2 py-1">1</td>
254
+ <td class="border px-2 py-1">899.99</td>
255
+ <td class="border px-2 py-1">2023-01-15</td>
256
+ </tr>
257
+ <tr>
258
+ <td class="border px-2 py-1">1002</td>
259
+ <td class="border px-2 py-1">Wireless Headphones</td>
260
+ <td class="border px-2 py-1">Electronics</td>
261
+ <td class="border px-2 py-1">2</td>
262
+ <td class="border px-2 py-1">129.99</td>
263
+ <td class="border px-2 py-1">2023-01-16</td>
264
+ </tr>
265
+ <tr>
266
+ <td class="border px-2 py-1">1003</td>
267
+ <td class="border px-2 py-1">Coffee Maker</td>
268
+ <td class="border px-2 py-1">Appliances</td>
269
+ <td class="border px-2 py-1">1</td>
270
+ <td class="border px-2 py-1">49.99</td>
271
+ <td class="border px-2 py-1">2023-01-17</td>
272
+ </tr>
273
+ </tbody>
274
+ </table>
275
+ </div>
276
+ </div>
277
+
278
+ <!-- Prompt Cell -->
279
+ <div class="code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden">
280
+ <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center">
281
+ <div class="flex space-x-2">
282
+ <span class="text-xs font-mono text-gray-500">In [ ]:</span>
283
+ </div>
284
+ <div class="flex space-x-2">
285
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell up">
286
+ <i class="fas fa-arrow-up"></i>
287
+ </button>
288
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell down">
289
+ <i class="fas fa-arrow-down"></i>
290
+ </button>
291
+ <button class="text-gray-500 hover:text-gray-700" title="Delete cell">
292
+ <i class="fas fa-trash"></i>
293
+ </button>
294
+ </div>
295
+ </div>
296
+ <div class="px-4 py-3">
297
+ <div class="flex items-start">
298
+ <div class="mr-3 text-purple-600">
299
+ <i class="fas fa-robot"></i>
300
+ </div>
301
+ <div class="flex-1">
302
+ <textarea class="prompt-input w-full p-2 border border-gray-300 rounded-lg focus:border-purple-500" rows="2" placeholder="Describe what you want to do with the data (e.g., 'Show me a bar chart of sales by category')"></textarea>
303
+ <div class="mt-2 flex justify-end space-x-2">
304
+ <button class="px-3 py-1 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300">
305
+ Clear
306
+ </button>
307
+ <button class="px-3 py-1 bg-purple-600 text-white rounded-lg hover:bg-purple-700 flex items-center space-x-1">
308
+ <i class="fas fa-magic"></i>
309
+ <span>Generate Code</span>
310
+ </button>
311
+ </div>
312
+ </div>
313
+ </div>
314
+ </div>
315
+ </div>
316
+
317
+ <!-- Generated Code Cell -->
318
+ <div class="code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden">
319
+ <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center">
320
+ <div class="flex space-x-2">
321
+ <button class="text-gray-500 hover:text-gray-700" title="Run cell">
322
+ <i class="fas fa-play"></i>
323
+ </button>
324
+ <button class="text-gray-500 hover:text-gray-700" title="Add cell below">
325
+ <i class="fas fa-plus"></i>
326
+ </button>
327
+ </div>
328
+ <div class="flex space-x-2">
329
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell up">
330
+ <i class="fas fa-arrow-up"></i>
331
+ </button>
332
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell down">
333
+ <i class="fas fa-arrow-down"></i>
334
+ </button>
335
+ <button class="text-gray-500 hover:text-gray-700" title="Delete cell">
336
+ <i class="fas fa-trash"></i>
337
+ </button>
338
+ </div>
339
+ </div>
340
+ <div class="px-4 py-3">
341
+ <div class="font-mono text-sm bg-gray-800 text-gray-100 p-3 rounded-lg overflow-x-auto">
342
+ <span class="text-green-400"># Generated code: Bar chart of sales by category</span><br>
343
+ <span class="text-blue-400">import</span> matplotlib.pyplot <span class="text-blue-400">as</span> plt<br>
344
+ <span class="text-blue-400">import</span> seaborn <span class="text-blue-400">as</span> sns<br><br>
345
+ <span class="text-green-400"># Group by category and sum the sales</span><br>
346
+ sales_by_category = df.groupby(<span class="text-yellow-300">'Category'</span>)[<span class="text-yellow-300">'Price'</span>].sum().reset_index()<br><br>
347
+ <span class="text-green-400"># Create bar plot</span><br>
348
+ plt.figure(figsize=(<span class="text-yellow-300">10, 6</span>))<br>
349
+ sns.barplot(x=<span class="text-yellow-300">'Category'</span>, y=<span class="text-yellow-300">'Price'</span>, data=sales_by_category)<br>
350
+ plt.title(<span class="text-yellow-300">'Total Sales by Product Category'</span>)<br>
351
+ plt.ylabel(<span class="text-yellow-300">'Total Sales ($)'</span>)<br>
352
+ plt.xticks(rotation=<span class="text-yellow-300">45</span>)<br>
353
+ plt.show()
354
+ </div>
355
+ </div>
356
+ </div>
357
+
358
+ <!-- Visualization Output Cell -->
359
+ <div class="output-cell rounded-lg mb-6 border border-gray-200 overflow-hidden fade-in">
360
+ <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center">
361
+ <span class="text-xs font-mono text-gray-500">Out[2]</span>
362
+ <button class="text-gray-500 hover:text-gray-700" title="Clear output">
363
+ <i class="fas fa-times"></i>
364
+ </button>
365
+ </div>
366
+ <div class="px-4 py-3">
367
+ <div class="h-64">
368
+ <canvas id="notebookChart"></canvas>
369
+ </div>
370
+ </div>
371
+ </div>
372
+
373
+ <!-- Add New Cell Button -->
374
+ <div class="flex justify-center mb-6">
375
+ <button class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 flex items-center space-x-2" onclick="addNewCell()">
376
+ <i class="fas fa-plus"></i>
377
+ <span>Add New Cell</span>
378
+ </button>
379
+ </div>
380
+ </main>
381
+ </div>
382
+ </div>
383
+
384
+ <script>
385
+ // Show/hide tool panel
386
+ function showTool(tool) {
387
+ const panel = document.getElementById('toolPanel');
388
+ const title = document.getElementById('toolTitle');
389
+ const content = document.getElementById('toolContent');
390
+
391
+ // Set title based on tool
392
+ switch(tool) {
393
+ case 'visualization':
394
+ title.textContent = 'Charts & Graphs';
395
+ content.innerHTML = `
396
+ <div class="grid grid-cols-2 gap-4">
397
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-purple-500" onclick="insertCode('bar')">
398
+ <div class="flex items-center space-x-2">
399
+ <i class="fas fa-chart-bar text-purple-600"></i>
400
+ <span>Bar Chart</span>
401
+ </div>
402
+ </div>
403
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-blue-500" onclick="insertCode('line')">
404
+ <div class="flex items-center space-x-2">
405
+ <i class="fas fa-chart-line text-blue-600"></i>
406
+ <span>Line Chart</span>
407
+ </div>
408
+ </div>
409
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-green-500" onclick="insertCode('pie')">
410
+ <div class="flex items-center space-x-2">
411
+ <i class="fas fa-chart-pie text-green-600"></i>
412
+ <span>Pie Chart</span>
413
+ </div>
414
+ </div>
415
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-yellow-500" onclick="insertCode('scatter')">
416
+ <div class="flex items-center space-x-2">
417
+ <i class="fas fa-chart-scatter text-yellow-600"></i>
418
+ <span>Scatter Plot</span>
419
+ </div>
420
+ </div>
421
+ </div>
422
+ <div class="mt-4">
423
+ <label class="block text-sm font-medium text-gray-700 mb-2">Custom Visualization Prompt:</label>
424
+ <div class="flex space-x-2">
425
+ <input type="text" id="vizPrompt" placeholder="E.g., 'Create a heatmap of correlation matrix'" class="flex-1 px-3 py-2 border border-gray-300 rounded-lg">
426
+ <button class="px-3 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700" onclick="generateFromPrompt('vizPrompt')">
427
+ Generate
428
+ </button>
429
+ </div>
430
+ </div>
431
+ `;
432
+ break;
433
+ case 'manipulation':
434
+ title.textContent = 'Data Manipulation';
435
+ content.innerHTML = `
436
+ <div class="grid grid-cols-2 gap-4">
437
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-purple-500" onclick="insertCode('clean')">
438
+ <div class="flex items-center space-x-2">
439
+ <i class="fas fa-broom text-purple-600"></i>
440
+ <span>Clean Data</span>
441
+ </div>
442
+ </div>
443
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-blue-500" onclick="insertCode('filter')">
444
+ <div class="flex items-center space-x-2">
445
+ <i class="fas fa-filter text-blue-600"></i>
446
+ <span>Filter Data</span>
447
+ </div>
448
+ </div>
449
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-green-500" onclick="insertCode('group')">
450
+ <div class="flex items-center space-x-2">
451
+ <i class="fas fa-layer-group text-green-600"></i>
452
+ <span>Group Data</span>
453
+ </div>
454
+ </div>
455
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-yellow-500" onclick="insertCode('transform')">
456
+ <div class="flex items-center space-x-2">
457
+ <i class="fas fa-exchange-alt text-yellow-600"></i>
458
+ <span>Transform Data</span>
459
+ </div>
460
+ </div>
461
+ </div>
462
+ <div class="mt-4">
463
+ <label class="block text-sm font-medium text-gray-700 mb-2">Custom Data Operation:</label>
464
+ <div class="flex space-x-2">
465
+ <input type="text" id="dataPrompt" placeholder="E.g., 'Remove rows with missing values in price column'" class="flex-1 px-3 py-2 border border-gray-300 rounded-lg">
466
+ <button class="px-3 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700" onclick="generateFromPrompt('dataPrompt')">
467
+ Generate
468
+ </button>
469
+ </div>
470
+ </div>
471
+ `;
472
+ break;
473
+ case 'insights':
474
+ title.textContent = 'Data Insights';
475
+ content.innerHTML = `
476
+ <div class="grid grid-cols-2 gap-4">
477
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-purple-500" onclick="insertCode('stats')">
478
+ <div class="flex items-center space-x-2">
479
+ <i class="fas fa-calculator text-purple-600"></i>
480
+ <span>Descriptive Stats</span>
481
+ </div>
482
+ </div>
483
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-blue-500" onclick="insertCode('corr')">
484
+ <div class="flex items-center space-x-2">
485
+ <i class="fas fa-project-diagram text-blue-600"></i>
486
+ <span>Correlations</span>
487
+ </div>
488
+ </div>
489
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-green-500" onclick="insertCode('outliers')">
490
+ <div class="flex items-center space-x-2">
491
+ <i class="fas fa-exclamation-triangle text-green-600"></i>
492
+ <span>Find Outliers</span>
493
+ </div>
494
+ </div>
495
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-yellow-500" onclick="insertCode('trends')">
496
+ <div class="flex items-center space-x-2">
497
+ <i class="fas fa-chart-line text-yellow-600"></i>
498
+ <span>Identify Trends</span>
499
+ </div>
500
+ </div>
501
+ </div>
502
+ <div class="mt-4">
503
+ <label class="block text-sm font-medium text-gray-700 mb-2">Ask a Question:</label>
504
+ <div class="flex space-x-2">
505
+ <input type="text" id="insightPrompt" placeholder="E.g., 'What factors affect customer satisfaction?'" class="flex-1 px-3 py-2 border border-gray-300 rounded-lg">
506
+ <button class="px-3 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700" onclick="generateFromPrompt('insightPrompt')">
507
+ Analyze
508
+ </button>
509
+ </div>
510
+ </div>
511
+ `;
512
+ break;
513
+ case 'science':
514
+ title.textContent = 'Data Science';
515
+ content.innerHTML = `
516
+ <div class="grid grid-cols-2 gap-4">
517
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-purple-500" onclick="insertCode('forecast')">
518
+ <div class="flex items-center space-x-2">
519
+ <i class="fas fa-chart-line text-purple-600"></i>
520
+ <span>Forecasting</span>
521
+ </div>
522
+ </div>
523
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-blue-500" onclick="insertCode('classify')">
524
+ <div class="flex items-center space-x-2">
525
+ <i class="fas fa-tags text-blue-600"></i>
526
+ <span>Classification</span>
527
+ </div>
528
+ </div>
529
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-green-500" onclick="insertCode('regress')">
530
+ <div class="flex items-center space-x-2">
531
+ <i class="fas fa-chart-area text-green-600"></i>
532
+ <span>Regression</span>
533
+ </div>
534
+ </div>
535
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-yellow-500" onclick="insertCode('cluster')">
536
+ <div class="flex items-center space-x-2">
537
+ <i class="fas fa-object-group text-yellow-600"></i>
538
+ <span>Clustering</span>
539
+ </div>
540
+ </div>
541
+ </div>
542
+ <div class="mt-4">
543
+ <label class="block text-sm font-medium text-gray-700 mb-2">Model Configuration:</label>
544
+ <div class="flex space-x-2">
545
+ <input type="text" id="modelPrompt" placeholder="E.g., 'Predict sales based on marketing spend'" class="flex-1 px-3 py-2 border border-gray-300 rounded-lg">
546
+ <button class="px-3 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700" onclick="generateFromPrompt('modelPrompt')">
547
+ Build
548
+ </button>
549
+ </div>
550
+ </div>
551
+ `;
552
+ break;
553
+ case 'reports':
554
+ title.textContent = 'Reports';
555
+ content.innerHTML = `
556
+ <div class="grid grid-cols-2 gap-4">
557
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-purple-500" onclick="insertCode('summary')">
558
+ <div class="flex items-center space-x-2">
559
+ <i class="fas fa-file-alt text-purple-600"></i>
560
+ <span>Summary Report</span>
561
+ </div>
562
+ </div>
563
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-blue-500" onclick="insertCode('export')">
564
+ <div class="flex items-center space-x-2">
565
+ <i class="fas fa-file-excel text-blue-600"></i>
566
+ <span>Export Data</span>
567
+ </div>
568
+ </div>
569
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-green-500" onclick="insertCode('presentation')">
570
+ <div class="flex items-center space-x-2">
571
+ <i class="fas fa-file-powerpoint text-green-600"></i>
572
+ <span>Presentation</span>
573
+ </div>
574
+ </div>
575
+ <div class="p-3 bg-gray-50 rounded-lg border border-gray-200 cursor-pointer hover:border-yellow-500" onclick="insertCode('dashboard')">
576
+ <div class="flex items-center space-x-2">
577
+ <i class="fas fa-tachometer-alt text-yellow-600"></i>
578
+ <span>Dashboard</span>
579
+ </div>
580
+ </div>
581
+ </div>
582
+ <div class="mt-4">
583
+ <label class="block text-sm font-medium text-gray-700 mb-2">Custom Report:</label>
584
+ <div class="flex space-x-2">
585
+ <input type="text" id="reportPrompt" placeholder="E.g., 'Create a quarterly performance report with charts'" class="flex-1 px-3 py-2 border border-gray-300 rounded-lg">
586
+ <button class="px-3 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700" onclick="generateFromPrompt('reportPrompt')">
587
+ Generate
588
+ </button>
589
+ </div>
590
+ </div>
591
+ `;
592
+ break;
593
+ }
594
+
595
+ panel.classList.remove('hidden');
596
+ }
597
+
598
+ function hideToolPanel() {
599
+ document.getElementById('toolPanel').classList.add('hidden');
600
+ }
601
+
602
+ // Insert code template based on selection
603
+ function insertCode(type) {
604
+ let code = '';
605
+
606
+ switch(type) {
607
+ case 'bar':
608
+ code = `# Create bar chart
609
+ import matplotlib.pyplot as plt
610
+ import seaborn as sns
611
+
612
+ # Group data and create plot
613
+ plt.figure(figsize=(10, 6))
614
+ sns.barplot(x='Category', y='Price', data=df)
615
+ plt.title('Bar Chart of Price by Category')
616
+ plt.ylabel('Price ($)')
617
+ plt.xticks(rotation=45)
618
+ plt.show()`;
619
+ break;
620
+ case 'line':
621
+ code = `# Create line chart
622
+ import matplotlib.pyplot as plt
623
+ import seaborn as sns
624
+
625
+ # Convert date column if needed
626
+ # df['Date'] = pd.to_datetime(df['Date'])
627
+
628
+ plt.figure(figsize=(10, 6))
629
+ sns.lineplot(x='Date', y='Value', data=df)
630
+ plt.title('Trend Over Time')
631
+ plt.ylabel('Value')
632
+ plt.xticks(rotation=45)
633
+ plt.show()`;
634
+ break;
635
+ case 'clean':
636
+ code = `# Clean data
637
+ # Remove duplicates
638
+ df = df.drop_duplicates()
639
+
640
+ # Handle missing values
641
+ df = df.dropna() # or df.fillna(value)
642
+
643
+ # Convert data types if needed
644
+ # df['Column'] = df['Column'].astype('category')`;
645
+ break;
646
+ case 'stats':
647
+ code = `# Descriptive statistics
648
+ print(df.describe())
649
+
650
+ # For categorical data
651
+ print(df.describe(include=['object']))`;
652
+ break;
653
+ case 'forecast':
654
+ code = `# Time series forecasting
655
+ from statsmodels.tsa.arima.model import ARIMA
656
+ from sklearn.metrics import mean_squared_error
657
+
658
+ # Prepare data (ensure it has a datetime index)
659
+ # df = df.set_index('Date')
660
+
661
+ # Fit model
662
+ model = ARIMA(df['Value'], order=(5,1,0))
663
+ model_fit = model.fit()
664
+
665
+ # Forecast
666
+ forecast = model_fit.forecast(steps=12)`;
667
+ break;
668
+ case 'summary':
669
+ code = `# Generate summary report
670
+ from IPython.display import HTML
671
+
672
+ # Create summary statistics
673
+ summary = df.describe().to_html()
674
+
675
+ # Display in notebook
676
+ HTML(f'''
677
+ <h2>Data Summary Report</h2>
678
+ <h3>Dataset Overview</h3>
679
+ <p>Total rows: {len(df)}</p>
680
+ <p>Columns: {', '.join(df.columns)}</p>
681
+ <h3>Statistics</h3>
682
+ {summary}
683
+ ''')`;
684
+ break;
685
+ }
686
+
687
+ // In a real app, this would insert the code into a new cell
688
+ alert(`Code template for ${type} would be inserted into a new cell:\n\n${code}`);
689
+ hideToolPanel();
690
+ }
691
+
692
+ // Generate code from prompt
693
+ function generateFromPrompt(promptId) {
694
+ const prompt = document.getElementById(promptId).value;
695
+ if (!prompt) return;
696
+
697
+ // In a real app, this would call an API to generate code
698
+ alert(`Generating code for: "${prompt}"\n\nThis would connect to an AI service in a real application.`);
699
+ hideToolPanel();
700
+ }
701
+
702
+ // Add new cell
703
+ function addNewCell() {
704
+ const container = document.getElementById('notebookContainer');
705
+ const newCell = document.createElement('div');
706
+ newCell.className = 'code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden fade-in';
707
+ newCell.innerHTML = `
708
+ <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center">
709
+ <div class="flex space-x-2">
710
+ <button class="text-gray-500 hover:text-gray-700" title="Run cell">
711
+ <i class="fas fa-play"></i>
712
+ </button>
713
+ <button class="text-gray-500 hover:text-gray-700" title="Add cell below">
714
+ <i class="fas fa-plus"></i>
715
+ </button>
716
+ </div>
717
+ <div class="flex space-x-2">
718
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell up">
719
+ <i class="fas fa-arrow-up"></i>
720
+ </button>
721
+ <button class="text-gray-500 hover:text-gray-700" title="Move cell down">
722
+ <i class="fas fa-arrow-down"></i>
723
+ </button>
724
+ <button class="text-gray-500 hover:text-gray-700" title="Delete cell">
725
+ <i class="fas fa-trash"></i>
726
+ </button>
727
+ </div>
728
+ </div>
729
+ <div class="px-4 py-3">
730
+ <div class="font-mono text-sm bg-gray-800 text-gray-100 p-3 rounded-lg">
731
+ <span class="text-green-400"># Enter your Python code here</span><br>
732
+ <span class="text-blue-400">import</span> pandas <span class="text-blue-400">as</span> pd<br>
733
+ <span class="text-blue-400">import</span> numpy <span class="text-blue-400">as</span> np
734
+ </div>
735
+ </div>
736
+ `;
737
+
738
+ // Insert before the "Add New Cell" button
739
+ const addButton = document.querySelector('#notebookContainer > div.flex.justify-center.mb-6');
740
+ container.insertBefore(newCell, addButton);
741
+
742
+ // Scroll to the new cell
743
+ newCell.scrollIntoView({ behavior: 'smooth' });
744
+ }
745
+
746
+ // Initialize notebook chart
747
+ document.addEventListener('DOMContentLoaded', function() {
748
+ const ctx = document.getElementById('notebookChart').getContext('2d');
749
+ const chart = new Chart(ctx, {
750
+ type: 'bar',
751
+ data: {
752
+ labels: ['Electronics', 'Appliances', 'Fitness', 'Home', 'Beauty'],
753
+ datasets: [{
754
+ label: 'Total Sales',
755
+ data: [42000, 32000, 28000, 24000, 18000],
756
+ backgroundColor: [
757
+ 'rgba(110, 142, 251, 0.7)',
758
+ 'rgba(167, 119, 227, 0.7)',
759
+ 'rgba(79, 209, 197, 0.7)',
760
+ 'rgba(254, 178, 54, 0.7)',
761
+ 'rgba(255, 107, 107, 0.7)'
762
+ ],
763
+ borderColor: [
764
+ 'rgba(110, 142, 251, 1)',
765
+ 'rgba(167, 119, 227, 1)',
766
+ 'rgba(79, 209, 197, 1)',
767
+ 'rgba(254, 178, 54, 1)',
768
+ 'rgba(255, 107, 107, 1)'
769
+ ],
770
+ borderWidth: 1
771
+ }]
772
+ },
773
+ options: {
774
+ responsive: true,
775
+ maintainAspectRatio: false,
776
+ plugins: {
777
+ legend: {
778
+ display: false
779
+ }
780
+ },
781
+ scales: {
782
+ y: {
783
+ beginAtZero: true,
784
+ grid: {
785
+ drawBorder: false
786
+ }
787
+ },
788
+ x: {
789
+ grid: {
790
+ display: false
791
+ }
792
+ }
793
+ }
794
+ }
795
+ });
796
+ });
797
+ </script>
798
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=vipra/ai-data-analyst-pingax" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
799
+ </html>