{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "b78fb013688f49e09893f986b46e17b1": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_26a0f5c6aa35438094ba329b2cca24d1", "IPY_MODEL_6d2205226c584736b22ac0009a647e0e", "IPY_MODEL_7c481d8f47474772bc804c8d26ecc2da" ], "layout": "IPY_MODEL_6a1bd864209c4e5fb2d06ae0470d9350" } }, "26a0f5c6aa35438094ba329b2cca24d1": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_4fc282e7d6e647328ebcd013aefb774b", "placeholder": "​", "style": "IPY_MODEL_bcb0a0dcf6044004867df51da0e3b307", "value": "Batches: 100%" } }, "6d2205226c584736b22ac0009a647e0e": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_eb95669d0d0245aa9251ab35374307ce", "max": 83, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_cfed69b9f821407b8fd014d3748bd34f", "value": 83 } }, "7c481d8f47474772bc804c8d26ecc2da": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_d703773e6f7e42159e652bb40476a716", "placeholder": "​", "style": "IPY_MODEL_e14ad5669d4f4df5a3a12dce60623ca9", "value": " 83/83 [03:37<00:00,  2.39s/it]" } }, "6a1bd864209c4e5fb2d06ae0470d9350": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "4fc282e7d6e647328ebcd013aefb774b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "bcb0a0dcf6044004867df51da0e3b307": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "eb95669d0d0245aa9251ab35374307ce": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "cfed69b9f821407b8fd014d3748bd34f": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "d703773e6f7e42159e652bb40476a716": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "e14ad5669d4f4df5a3a12dce60623ca9": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "sXhN8B0iqec4", "outputId": "a6c8eb17-9fce-42ae-dfdc-7ef300d4c737" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/67.3 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.3/67.3 kB\u001b[0m \u001b[31m4.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n", " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m19.3/19.3 MB\u001b[0m \u001b[31m30.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m284.2/284.2 kB\u001b[0m \u001b[31m15.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.9/1.9 MB\u001b[0m \u001b[31m47.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m101.6/101.6 kB\u001b[0m \u001b[31m5.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m16.4/16.4 MB\u001b[0m \u001b[31m71.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m65.8/65.8 kB\u001b[0m \u001b[31m4.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m55.7/55.7 kB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m118.5/118.5 kB\u001b[0m \u001b[31m7.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m196.2/196.2 kB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m105.4/105.4 kB\u001b[0m \u001b[31m8.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.2/71.2 kB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m459.8/459.8 kB\u001b[0m \u001b[31m26.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.0/4.0 MB\u001b[0m \u001b[31m65.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m453.1/453.1 kB\u001b[0m \u001b[31m31.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.0/46.0 kB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m86.8/86.8 kB\u001b[0m \u001b[31m6.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h Building wheel for pypika (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n", "Reading package lists...\n", "Building dependency tree...\n", "Reading state information...\n", "tesseract-ocr is already the newest version (4.1.1-2.1build1).\n", "The following NEW packages will be installed:\n", " poppler-utils\n", "0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.\n", "Need to get 186 kB of archives.\n", "After this operation, 697 kB of additional disk space will be used.\n", "Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 poppler-utils amd64 22.02.0-2ubuntu0.8 [186 kB]\n", "Fetched 186 kB in 1s (371 kB/s)\n", "Selecting previously unselected package poppler-utils.\n", "(Reading database ... 126319 files and directories currently installed.)\n", "Preparing to unpack .../poppler-utils_22.02.0-2ubuntu0.8_amd64.deb ...\n", "Unpacking poppler-utils (22.02.0-2ubuntu0.8) ...\n", "Setting up poppler-utils (22.02.0-2ubuntu0.8) ...\n", "Processing triggers for man-db (2.10.2-1) ...\n" ] } ], "source": [ "# Step 1: Install dependencies\n", "!pip install -q chromadb tiktoken\n", "!apt-get -q install -y poppler-utils tesseract-ocr\n", "!pip install -q pytesseract" ] }, { "cell_type": "code", "source": [ "# Step 2: Setup folder structure\n", "import os\n", "\n", "# Clean slate (optional)\n", "!rm -rf /content/wwmad_workspace\n", "\n", "# Create working folders\n", "os.makedirs(\"/content/wwmad_workspace/data\", exist_ok=True)\n", "os.makedirs(\"/content/wwmad_workspace/chroma_db\", exist_ok=True)\n", "\n", "# Display where to upload\n", "print(\"Upload your cleaned .txt files to: /content/wwmad_workspace/data/\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "BNwakG9IrcFi", "outputId": "83ff44c8-abb5-42bb-f2ea-9137471a092f" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Upload your cleaned .txt files to: /content/wwmad_workspace/data/\n" ] } ] }, { "cell_type": "code", "source": [ "# Step 3: Enhanced Chunking with Heuristics and Metadata\n", "import os\n", "import re\n", "import glob\n", "import hashlib\n", "from typing import List, Dict\n", "\n", "DATA_DIR = \"/content/wwmad_workspace/data\"\n", "\n", "def clean_and_chunk_text(path: str, chunk_size: int = 500, overlap: int = 50) -> List[Dict]:\n", " with open(path, \"r\", encoding=\"utf-8\") as file:\n", " raw_text = file.read()\n", "\n", " # Remove Project Gutenberg boilerplate (if present)\n", " start_match = re.search(r\"\\*\\*\\* START OF.+?\\*\\*\\*\", raw_text, re.IGNORECASE)\n", " if start_match:\n", " raw_text = raw_text[start_match.end():]\n", "\n", " end_match = re.search(r\"\\*\\*\\* END OF.+?\\*\\*\\*\", raw_text, re.IGNORECASE)\n", " if end_match:\n", " raw_text = raw_text[:end_match.start()]\n", "\n", " # Normalize whitespace\n", " raw_text = re.sub(r\"\\s+\", \" \", raw_text).strip()\n", "\n", " # Metadata extraction\n", " file_name = os.path.basename(path)\n", " title = os.path.splitext(file_name)[0].replace(\"_\", \" \").title()\n", "\n", " author_lookup = {\n", " \"Meditations.txt\": \"Marcus Aurelius\",\n", " \"ThoughtsMA.txt\": \"Marcus Aurelius\",\n", " \"SelbstbetrachtungenMA.txt\": \"Marcus Aurelius\",\n", " \"10_epictetus_quotes.txt\": \"Epictetus\",\n", " \"200_epictetus_quotes.txt\": \"Epictetus\",\n", " \"100_ma_quotes.txt\": \"Marcus Aurelius\",\n", " \"100_seneca_quotes.txt\": \"Seneca\",\n", " }\n", " author = author_lookup.get(file_name, \"Unknown\")\n", "\n", " # Chunking\n", " chunks = []\n", " start = 0\n", " chunk_id = 0\n", " while start < len(raw_text):\n", " end = start + chunk_size\n", " chunk_text = raw_text[start:end]\n", " chunk_hash = hashlib.md5(chunk_text.encode()).hexdigest()\n", "\n", " chunks.append({\n", " \"content\": chunk_text,\n", " \"metadata\": {\n", " \"chunk_id\": chunk_id,\n", " \"source\": file_name,\n", " \"title\": title,\n", " \"author\": author,\n", " \"hash\": chunk_hash\n", " }\n", " })\n", "\n", " start += chunk_size - overlap\n", " chunk_id += 1\n", "\n", " return chunks\n", "\n", "\n", "# Run on all .txt files\n", "all_chunks = []\n", "file_paths = glob.glob(os.path.join(DATA_DIR, \"*.txt\"))\n", "\n", "for path in file_paths:\n", " chunks = clean_and_chunk_text(path)\n", " all_chunks.extend(chunks)\n", "\n", "print(f\"✅ Enriched {len(file_paths)} files into {len(all_chunks)} chunks with metadata.\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "NcI-GO6Lr3gC", "outputId": "917abe43-b84d-4b46-b30d-ffef7e5593b3" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "✅ Enriched 7 files into 2632 chunks with metadata.\n" ] } ] }, { "cell_type": "code", "source": [ "# Install the updated ChromaDB (if not already done)\n", "!pip install chromadb --upgrade --quiet\n", "\n", "# Correct import and setup\n", "import chromadb\n", "\n", "CHROMA_DIR = \"/content/wwmad_workspace/chroma_db\"\n", "\n", "# Use the new client setup directly\n", "client = chromadb.PersistentClient(path=CHROMA_DIR)\n", "\n", "# Create or load a collection\n", "collection = client.get_or_create_collection(\"wwmad_quotes\")\n" ], "metadata": { "id": "fX6sbiDisCeN" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Prepare for ingestion\n", "documents = [chunk[\"content\"] for chunk in all_chunks]\n", "metadatas = [chunk[\"metadata\"] for chunk in all_chunks]\n", "ids = [chunk[\"metadata\"][\"hash\"] for chunk in all_chunks] # Unique hash-based ID\n", "\n", "# Compute embeddings\n", "model = SentenceTransformer(\"all-MiniLM-L6-v2\")\n", "embeddings = model.encode(documents, show_progress_bar=True)\n", "\n", "# Add to ChromaDB collection\n", "collection.add(\n", " documents=documents,\n", " metadatas=metadatas,\n", " embeddings=embeddings,\n", " ids=ids\n", ")\n", "\n", "print(f\"✅ Ingested {len(documents)} enriched chunks into ChromaDB.\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 66, "referenced_widgets": [ "b78fb013688f49e09893f986b46e17b1", "26a0f5c6aa35438094ba329b2cca24d1", "6d2205226c584736b22ac0009a647e0e", "7c481d8f47474772bc804c8d26ecc2da", "6a1bd864209c4e5fb2d06ae0470d9350", "4fc282e7d6e647328ebcd013aefb774b", "bcb0a0dcf6044004867df51da0e3b307", "eb95669d0d0245aa9251ab35374307ce", "cfed69b9f821407b8fd014d3748bd34f", "d703773e6f7e42159e652bb40476a716", "e14ad5669d4f4df5a3a12dce60623ca9" ] }, "id": "77olnzOOtfqu", "outputId": "0892f837-cef5-4f46-8b70-285918350a04" }, "execution_count": null, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "Batches: 0%| | 0/83 [00:00" ], "application/javascript": [ "\n", " async function download(id, filename, size) {\n", " if (!google.colab.kernel.accessAllowed) {\n", " return;\n", " }\n", " const div = document.createElement('div');\n", " const label = document.createElement('label');\n", " label.textContent = `Downloading \"${filename}\": `;\n", " div.appendChild(label);\n", " const progress = document.createElement('progress');\n", " progress.max = size;\n", " div.appendChild(progress);\n", " document.body.appendChild(div);\n", "\n", " const buffers = [];\n", " let downloaded = 0;\n", "\n", " const channel = await google.colab.kernel.comms.open(id);\n", " // Send a message to notify the kernel that we're ready.\n", " channel.send({})\n", "\n", " for await (const message of channel.messages) {\n", " // Send a message to notify the kernel that we're ready.\n", " channel.send({})\n", " if (message.buffers) {\n", " for (const buffer of message.buffers) {\n", " buffers.push(buffer);\n", " downloaded += buffer.byteLength;\n", " progress.value = downloaded;\n", " }\n", " }\n", " }\n", " const blob = new Blob(buffers, {type: 'application/binary'});\n", " const a = document.createElement('a');\n", " a.href = window.URL.createObjectURL(blob);\n", " a.download = filename;\n", " div.appendChild(a);\n", " a.click();\n", " div.remove();\n", " }\n", " " ] }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "application/javascript": [ "download(\"download_2cd61887-507e-4bc6-a5ec-aee882e2720c\", \"chroma_db_export.zip\", 20504603)" ] }, "metadata": {} } ] } ] }