Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>AI Data Analyst | Interactive Notebook</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%); | |
| } | |
| .sidebar-item:hover { | |
| background-color: rgba(255, 255, 255, 0.1); | |
| transform: translateX(5px); | |
| } | |
| .code-cell { | |
| border-left: 4px solid #6e8efb; | |
| transition: all 0.3s ease; | |
| } | |
| .code-cell:hover { | |
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); | |
| } | |
| .output-cell { | |
| background-color: #f8f9fa; | |
| border-left: 4px solid #4fd1c5; | |
| } | |
| .cm-editor { | |
| height: auto; | |
| font-size: 14px; | |
| line-height: 1.5; | |
| } | |
| .cm-gutters { | |
| background-color: #f8f9fa ; | |
| } | |
| .cm-activeLineGutter { | |
| background-color: #e9ecef ; | |
| } | |
| .cm-activeLine { | |
| background-color: #f1f3f5 ; | |
| } | |
| .prompt-input:focus { | |
| outline: none; | |
| box-shadow: 0 0 0 2px rgba(110, 142, 251, 0.5); | |
| } | |
| .notebook-container { | |
| scroll-behavior: smooth; | |
| } | |
| .cell-toolbar { | |
| opacity: 0; | |
| transition: opacity 0.2s ease; | |
| } | |
| .code-cell:hover .cell-toolbar { | |
| opacity: 1; | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.3s ease-in; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; } | |
| to { opacity: 1; } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 font-sans"> | |
| <div class="flex h-screen overflow-hidden"> | |
| <!-- Sidebar --> | |
| <div class="gradient-bg text-white w-64 flex-shrink-0 hidden md:flex flex-col"> | |
| <div class="p-4 flex items-center space-x-3"> | |
| <i class="fas fa-brain text-2xl"></i> | |
| <h1 class="text-xl font-bold">AI Data Analyst</h1> | |
| </div> | |
| <div class="flex-1 overflow-y-auto"> | |
| <div class="p-4"> | |
| <div class="mb-6"> | |
| <h2 class="text-sm uppercase font-semibold mb-2 opacity-70">Main</h2> | |
| <div class="space-y-1"> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200"> | |
| <i class="fas fa-tachometer-alt"></i> | |
| <span>Dashboard</span> | |
| </a> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200 bg-white bg-opacity-10"> | |
| <i class="fas fa-book"></i> | |
| <span>Notebooks</span> | |
| </a> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <h2 class="text-sm uppercase font-semibold mb-2 opacity-70">Analysis Tools</h2> | |
| <div class="space-y-1"> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('visualization')"> | |
| <i class="fas fa-chart-line"></i> | |
| <span>Charts & Graphs</span> | |
| </a> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('manipulation')"> | |
| <i class="fas fa-filter"></i> | |
| <span>Data Manipulation</span> | |
| </a> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('insights')"> | |
| <i class="fas fa-lightbulb"></i> | |
| <span>Insights</span> | |
| </a> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('science')"> | |
| <i class="fas fa-flask"></i> | |
| <span>Data Science</span> | |
| </a> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200" onclick="showTool('reports')"> | |
| <i class="fas fa-file-alt"></i> | |
| <span>Reports</span> | |
| </a> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <h2 class="text-sm uppercase font-semibold mb-2 opacity-70">Datasets</h2> | |
| <div class="space-y-1"> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200"> | |
| <i class="fas fa-database"></i> | |
| <span>Browse Data</span> | |
| </a> | |
| <a href="#" class="sidebar-item flex items-center space-x-3 p-2 rounded-lg transition-all duration-200"> | |
| <i class="fas fa-upload"></i> | |
| <span>Upload Data</span> | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="p-4 border-t border-white border-opacity-10"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 rounded-full bg-white bg-opacity-20 flex items-center justify-center"> | |
| <i class="fas fa-user"></i> | |
| </div> | |
| <div> | |
| <div class="font-medium">John Doe</div> | |
| <div class="text-xs opacity-70">Admin</div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="flex-1 flex flex-col overflow-hidden"> | |
| <!-- Top Navigation --> | |
| <header class="bg-white border-b border-gray-200 flex items-center justify-between p-4"> | |
| <div class="flex items-center space-x-4"> | |
| <button class="md:hidden text-gray-600"> | |
| <i class="fas fa-bars"></i> | |
| </button> | |
| <h1 class="text-xl font-bold text-gray-800">Interactive Analysis Notebook</h1> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <div class="flex space-x-2"> | |
| <button class="px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center space-x-2"> | |
| <i class="fas fa-save text-gray-600"></i> | |
| <span>Save</span> | |
| </button> | |
| <button class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 flex items-center space-x-2"> | |
| <i class="fas fa-play"></i> | |
| <span>Run All</span> | |
| </button> | |
| <button class="px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center space-x-2"> | |
| <i class="fas fa-file-export text-gray-600"></i> | |
| <span>Export</span> | |
| </button> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Tool Selection Panel --> | |
| <div id="toolPanel" class="bg-white border-b border-gray-200 p-4 hidden"> | |
| <div class="flex items-center justify-between"> | |
| <h2 class="font-medium" id="toolTitle">Tool</h2> | |
| <button onclick="hideToolPanel()" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div id="toolContent" class="mt-3"> | |
| <!-- Tool content will be loaded here --> | |
| </div> | |
| </div> | |
| <!-- Notebook Container --> | |
| <main class="flex-1 overflow-y-auto notebook-container bg-white p-4" id="notebookContainer"> | |
| <!-- Welcome Cell --> | |
| <div class="mb-6 bg-blue-50 border-l-4 border-blue-500 p-4 rounded-r-lg"> | |
| <h2 class="text-lg font-bold text-blue-800 mb-2">Welcome to your Interactive Analysis Notebook!</h2> | |
| <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> | |
| </div> | |
| <!-- Sample Data Load Cell --> | |
| <div class="code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden"> | |
| <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center"> | |
| <div class="flex space-x-2"> | |
| <button class="text-gray-500 hover:text-gray-700" title="Run cell"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Add cell below"> | |
| <i class="fas fa-plus"></i> | |
| </button> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="text-gray-500 hover:text-gray-700" title="Move cell up"> | |
| <i class="fas fa-arrow-up"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Move cell down"> | |
| <i class="fas fa-arrow-down"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Delete cell"> | |
| <i class="fas fa-trash"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="px-4 py-3"> | |
| <div class="font-mono text-sm bg-gray-800 text-gray-100 p-3 rounded-lg overflow-x-auto"> | |
| <span class="text-green-400"># Sample data loading</span><br> | |
| <span class="text-blue-400">import</span> pandas <span class="text-blue-400">as</span> pd<br> | |
| <span class="text-blue-400">import</span> numpy <span class="text-blue-400">as</span> np<br><br> | |
| <span class="text-green-400"># Load sample sales data</span><br> | |
| df = pd.read_csv(<span class="text-yellow-300">'sample_sales_data.csv'</span>)<br> | |
| df.head() | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Output Cell --> | |
| <div class="output-cell rounded-lg mb-6 border border-gray-200 overflow-hidden fade-in"> | |
| <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center"> | |
| <span class="text-xs font-mono text-gray-500">Out[1]</span> | |
| <button class="text-gray-500 hover:text-gray-700" title="Clear output"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="px-4 py-3 overflow-x-auto"> | |
| <table class="min-w-full border border-gray-200 text-sm"> | |
| <thead class="bg-gray-100"> | |
| <tr> | |
| <th class="border px-2 py-1">Order ID</th> | |
| <th class="border px-2 py-1">Product</th> | |
| <th class="border px-2 py-1">Category</th> | |
| <th class="border px-2 py-1">Quantity</th> | |
| <th class="border px-2 py-1">Price</th> | |
| <th class="border px-2 py-1">Order Date</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td class="border px-2 py-1">1001</td> | |
| <td class="border px-2 py-1">Ultra HD TV</td> | |
| <td class="border px-2 py-1">Electronics</td> | |
| <td class="border px-2 py-1">1</td> | |
| <td class="border px-2 py-1">899.99</td> | |
| <td class="border px-2 py-1">2023-01-15</td> | |
| </tr> | |
| <tr> | |
| <td class="border px-2 py-1">1002</td> | |
| <td class="border px-2 py-1">Wireless Headphones</td> | |
| <td class="border px-2 py-1">Electronics</td> | |
| <td class="border px-2 py-1">2</td> | |
| <td class="border px-2 py-1">129.99</td> | |
| <td class="border px-2 py-1">2023-01-16</td> | |
| </tr> | |
| <tr> | |
| <td class="border px-2 py-1">1003</td> | |
| <td class="border px-2 py-1">Coffee Maker</td> | |
| <td class="border px-2 py-1">Appliances</td> | |
| <td class="border px-2 py-1">1</td> | |
| <td class="border px-2 py-1">49.99</td> | |
| <td class="border px-2 py-1">2023-01-17</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <!-- Prompt Cell --> | |
| <div class="code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden"> | |
| <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center"> | |
| <div class="flex space-x-2"> | |
| <span class="text-xs font-mono text-gray-500">In [ ]:</span> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="text-gray-500 hover:text-gray-700" title="Move cell up"> | |
| <i class="fas fa-arrow-up"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Move cell down"> | |
| <i class="fas fa-arrow-down"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Delete cell"> | |
| <i class="fas fa-trash"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="px-4 py-3"> | |
| <div class="flex items-start"> | |
| <div class="mr-3 text-purple-600"> | |
| <i class="fas fa-robot"></i> | |
| </div> | |
| <div class="flex-1"> | |
| <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> | |
| <div class="mt-2 flex justify-end space-x-2"> | |
| <button class="px-3 py-1 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300"> | |
| Clear | |
| </button> | |
| <button class="px-3 py-1 bg-purple-600 text-white rounded-lg hover:bg-purple-700 flex items-center space-x-1"> | |
| <i class="fas fa-magic"></i> | |
| <span>Generate Code</span> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Generated Code Cell --> | |
| <div class="code-cell bg-white rounded-lg mb-4 border border-gray-200 overflow-hidden"> | |
| <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center"> | |
| <div class="flex space-x-2"> | |
| <button class="text-gray-500 hover:text-gray-700" title="Run cell"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Add cell below"> | |
| <i class="fas fa-plus"></i> | |
| </button> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="text-gray-500 hover:text-gray-700" title="Move cell up"> | |
| <i class="fas fa-arrow-up"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Move cell down"> | |
| <i class="fas fa-arrow-down"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700" title="Delete cell"> | |
| <i class="fas fa-trash"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="px-4 py-3"> | |
| <div class="font-mono text-sm bg-gray-800 text-gray-100 p-3 rounded-lg overflow-x-auto"> | |
| <span class="text-green-400"># Generated code: Bar chart of sales by category</span><br> | |
| <span class="text-blue-400">import</span> matplotlib.pyplot <span class="text-blue-400">as</span> plt<br> | |
| <span class="text-blue-400">import</span> seaborn <span class="text-blue-400">as</span> sns<br><br> | |
| <span class="text-green-400"># Group by category and sum the sales</span><br> | |
| sales_by_category = df.groupby(<span class="text-yellow-300">'Category'</span>)[<span class="text-yellow-300">'Price'</span>].sum().reset_index()<br><br> | |
| <span class="text-green-400"># Create bar plot</span><br> | |
| plt.figure(figsize=(<span class="text-yellow-300">10, 6</span>))<br> | |
| sns.barplot(x=<span class="text-yellow-300">'Category'</span>, y=<span class="text-yellow-300">'Price'</span>, data=sales_by_category)<br> | |
| plt.title(<span class="text-yellow-300">'Total Sales by Product Category'</span>)<br> | |
| plt.ylabel(<span class="text-yellow-300">'Total Sales ($)'</span>)<br> | |
| plt.xticks(rotation=<span class="text-yellow-300">45</span>)<br> | |
| plt.show() | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Visualization Output Cell --> | |
| <div class="output-cell rounded-lg mb-6 border border-gray-200 overflow-hidden fade-in"> | |
| <div class="cell-toolbar bg-gray-50 px-3 py-1 flex justify-between items-center"> | |
| <span class="text-xs font-mono text-gray-500">Out[2]</span> | |
| <button class="text-gray-500 hover:text-gray-700" title="Clear output"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="px-4 py-3"> | |
| <div class="h-64"> | |
| <canvas id="notebookChart"></canvas> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Add New Cell Button --> | |
| <div class="flex justify-center mb-6"> | |
| <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()"> | |
| <i class="fas fa-plus"></i> | |
| <span>Add New Cell</span> | |
| </button> | |
| </div> | |
| </main> | |
| </div> | |
| </div> | |
| <script> | |
| </script> | |
| <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> | |
| </html> |