{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": { "id": "3w42Q_P57rBD", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "82dbd30f-7c3b-40ff-a952-c0c6f08c23bb" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting reportlab\n", " Downloading reportlab-4.4.9-py3-none-any.whl.metadata (1.7 kB)\n", "Requirement already satisfied: pillow>=9.0.0 in /usr/local/lib/python3.12/dist-packages (from reportlab) (11.3.0)\n", "Requirement already satisfied: charset-normalizer in /usr/local/lib/python3.12/dist-packages (from reportlab) (3.4.4)\n", "Downloading reportlab-4.4.9-py3-none-any.whl (2.0 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m16.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hInstalling collected packages: reportlab\n", "Successfully installed reportlab-4.4.9\n" ] } ], "source": [ "# !pip install reportlab" ] }, { "cell_type": "code", "source": [ "from reportlab.lib.pagesizes import letter\n", "from reportlab.pdfgen import canvas\n", "\n", "file_name = \"ml_notes.pdf\"\n", "\n", "content = \"\"\"\n", "Machine Learning is a field of AI that enables systems to learn from data.\n", "Supervised learning uses labeled data.\n", "Unsupervised learning finds hidden patterns.\n", "Gradient descent is an optimization algorithm.\n", "Neural networks consist of layers of neurons.\n", "Transformers use attention instead of recurrence.\n", "RAG combines retrieval with generation.\n", "\"\"\"\n", "\n", "c = canvas.Canvas(file_name, pagesize=letter)\n", "text = c.beginText(40, 750)\n", "\n", "for line in content.split(\"\\n\"):\n", " text.textLine(line)\n", "\n", "c.drawText(text)\n", "c.save()\n", "\n", "file_name\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 36 }, "id": "x01NUJYn7zB7", "outputId": "fea09146-177e-4249-b1ee-0cd305d5f1ff" }, "execution_count": 4, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'ml_notes.pdf'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 4 } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "-bmMFZ6O7vao" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "3MJ3bjqGk2wC" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "9Q4TiNi3k2ym" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "E6EcSlMRk207" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "9rdLfO2Fk23F" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "a-zc15CJk25l" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "UMhIOJ8mk29I" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "G6GDwLSSk2-8" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "LYOphCu4k3Bs" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "%pip install langchain langchain-community langchain-huggingface \\\n", "sentence-transformers faiss-cpu transformers pypdf gradio\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "FeWt3njw7_Av", "outputId": "3d996de0-31f0-403f-b2cd-f4255ac9a27b" }, "execution_count": 7, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: langchain in /usr/local/lib/python3.12/dist-packages (1.2.8)\n", "Collecting langchain-community\n", " Downloading langchain_community-0.4.1-py3-none-any.whl.metadata (3.0 kB)\n", "Collecting langchain-huggingface\n", " Downloading langchain_huggingface-1.2.0-py3-none-any.whl.metadata (2.8 kB)\n", "Requirement already satisfied: sentence-transformers in /usr/local/lib/python3.12/dist-packages (5.2.2)\n", "Collecting faiss-cpu\n", " Downloading faiss_cpu-1.13.2-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (7.6 kB)\n", "Requirement already satisfied: transformers in /usr/local/lib/python3.12/dist-packages (5.0.0)\n", "Collecting pypdf\n", " Downloading pypdf-6.7.0-py3-none-any.whl.metadata (7.1 kB)\n", "Requirement already satisfied: gradio in /usr/local/lib/python3.12/dist-packages (5.50.0)\n", "Requirement already satisfied: langchain-core<2.0.0,>=1.2.8 in /usr/local/lib/python3.12/dist-packages (from langchain) (1.2.9)\n", "Requirement already satisfied: langgraph<1.1.0,>=1.0.7 in /usr/local/lib/python3.12/dist-packages (from langchain) (1.0.7)\n", "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in /usr/local/lib/python3.12/dist-packages (from langchain) (2.12.3)\n", "Collecting langchain-classic<2.0.0,>=1.0.0 (from langchain-community)\n", " Downloading langchain_classic-1.0.1-py3-none-any.whl.metadata (4.2 kB)\n", "Requirement already satisfied: SQLAlchemy<3.0.0,>=1.4.0 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (2.0.46)\n", "Collecting requests<3.0.0,>=2.32.5 (from langchain-community)\n", " Downloading requests-2.32.5-py3-none-any.whl.metadata (4.9 kB)\n", "Requirement already satisfied: PyYAML<7.0.0,>=5.3.0 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (6.0.3)\n", "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (3.13.3)\n", "Requirement already satisfied: tenacity!=8.4.0,<10.0.0,>=8.1.0 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (9.1.3)\n", "Collecting dataclasses-json<0.7.0,>=0.6.7 (from langchain-community)\n", " Downloading dataclasses_json-0.6.7-py3-none-any.whl.metadata (25 kB)\n", "Requirement already satisfied: pydantic-settings<3.0.0,>=2.10.1 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (2.12.0)\n", "Requirement already satisfied: langsmith<1.0.0,>=0.1.125 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (0.6.9)\n", "Requirement already satisfied: httpx-sse<1.0.0,>=0.4.0 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (0.4.3)\n", "Requirement already satisfied: numpy>=1.26.2 in /usr/local/lib/python3.12/dist-packages (from langchain-community) (2.0.2)\n", "Collecting huggingface-hub<1.0.0,>=0.33.4 (from langchain-huggingface)\n", " Downloading huggingface_hub-0.36.2-py3-none-any.whl.metadata (15 kB)\n", "Requirement already satisfied: tokenizers<1.0.0,>=0.19.1 in /usr/local/lib/python3.12/dist-packages (from langchain-huggingface) (0.22.2)\n", "Requirement already satisfied: torch>=1.11.0 in /usr/local/lib/python3.12/dist-packages (from sentence-transformers) (2.9.0+cpu)\n", "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.12/dist-packages (from sentence-transformers) (1.6.1)\n", "Requirement already satisfied: scipy in /usr/local/lib/python3.12/dist-packages (from sentence-transformers) (1.16.3)\n", "Requirement already satisfied: typing_extensions>=4.5.0 in /usr/local/lib/python3.12/dist-packages (from sentence-transformers) (4.15.0)\n", "Requirement already satisfied: tqdm in /usr/local/lib/python3.12/dist-packages (from sentence-transformers) (4.67.3)\n", "Requirement already satisfied: packaging in /usr/local/lib/python3.12/dist-packages (from faiss-cpu) (26.0)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from transformers) (3.20.3)\n", "INFO: pip is looking at multiple versions of transformers to determine which version is compatible with other requirements. This could take a while.\n", "Collecting transformers\n", " Downloading transformers-5.1.0-py3-none-any.whl.metadata (31 kB)\n", " Downloading transformers-4.57.6-py3-none-any.whl.metadata (43 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.0/44.0 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.12/dist-packages (from transformers) (2025.11.3)\n", "Requirement already satisfied: safetensors>=0.4.3 in /usr/local/lib/python3.12/dist-packages (from transformers) (0.7.0)\n", "Requirement already satisfied: aiofiles<25.0,>=22.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (24.1.0)\n", "Requirement already satisfied: anyio<5.0,>=3.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (4.12.1)\n", "Requirement already satisfied: brotli>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (1.2.0)\n", "Requirement already satisfied: fastapi<1.0,>=0.115.2 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.128.2)\n", "Requirement already satisfied: ffmpy in /usr/local/lib/python3.12/dist-packages (from gradio) (1.0.0)\n", "Requirement already satisfied: gradio-client==1.14.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (1.14.0)\n", "Requirement already satisfied: groovy~=0.1 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.1.2)\n", "Requirement already satisfied: httpx<1.0,>=0.24.1 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.28.1)\n", "Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (3.1.6)\n", "Requirement already satisfied: markupsafe<4.0,>=2.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (3.0.3)\n", "Requirement already satisfied: orjson~=3.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (3.11.7)\n", "Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (2.2.2)\n", "Requirement already satisfied: pillow<12.0,>=8.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (11.3.0)\n", "Requirement already satisfied: pydub in /usr/local/lib/python3.12/dist-packages (from gradio) (0.25.1)\n", "Requirement already satisfied: python-multipart>=0.0.18 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.0.22)\n", "Requirement already satisfied: ruff>=0.9.3 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.15.0)\n", "Requirement already satisfied: safehttpx<0.2.0,>=0.1.6 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.1.7)\n", "Requirement already satisfied: semantic-version~=2.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (2.10.0)\n", "Requirement already satisfied: starlette<1.0,>=0.40.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.50.0)\n", "Requirement already satisfied: tomlkit<0.14.0,>=0.12.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.13.3)\n", "Requirement already satisfied: typer<1.0,>=0.12 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.21.1)\n", "Requirement already satisfied: uvicorn>=0.14.0 in /usr/local/lib/python3.12/dist-packages (from gradio) (0.40.0)\n", "Requirement already satisfied: fsspec in /usr/local/lib/python3.12/dist-packages (from gradio-client==1.14.0->gradio) (2025.3.0)\n", "Requirement already satisfied: websockets<16.0,>=13.0 in /usr/local/lib/python3.12/dist-packages (from gradio-client==1.14.0->gradio) (15.0.1)\n", "Requirement already satisfied: aiohappyeyeballs>=2.5.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (2.6.1)\n", "Requirement already satisfied: aiosignal>=1.4.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.4.0)\n", "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (25.4.0)\n", "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.8.0)\n", "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (6.7.1)\n", "Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (0.4.1)\n", "Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.22.0)\n", "Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.12/dist-packages (from anyio<5.0,>=3.0->gradio) (3.11)\n", "Collecting marshmallow<4.0.0,>=3.18.0 (from dataclasses-json<0.7.0,>=0.6.7->langchain-community)\n", " Downloading marshmallow-3.26.2-py3-none-any.whl.metadata (7.3 kB)\n", "Collecting typing-inspect<1,>=0.4.0 (from dataclasses-json<0.7.0,>=0.6.7->langchain-community)\n", " Downloading typing_inspect-0.9.0-py3-none-any.whl.metadata (1.5 kB)\n", "Requirement already satisfied: typing-inspection>=0.4.2 in /usr/local/lib/python3.12/dist-packages (from fastapi<1.0,>=0.115.2->gradio) (0.4.2)\n", "Requirement already satisfied: annotated-doc>=0.0.2 in /usr/local/lib/python3.12/dist-packages (from fastapi<1.0,>=0.115.2->gradio) (0.0.4)\n", "Requirement already satisfied: certifi in /usr/local/lib/python3.12/dist-packages (from httpx<1.0,>=0.24.1->gradio) (2026.1.4)\n", "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.12/dist-packages (from httpx<1.0,>=0.24.1->gradio) (1.0.9)\n", "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.12/dist-packages (from httpcore==1.*->httpx<1.0,>=0.24.1->gradio) (0.16.0)\n", "Requirement already satisfied: hf-xet<2.0.0,>=1.1.3 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<1.0.0,>=0.33.4->langchain-huggingface) (1.2.0)\n", "Collecting langchain-text-splitters<2.0.0,>=1.1.0 (from langchain-classic<2.0.0,>=1.0.0->langchain-community)\n", " Downloading langchain_text_splitters-1.1.0-py3-none-any.whl.metadata (2.7 kB)\n", "Requirement already satisfied: jsonpatch<2.0.0,>=1.33.0 in /usr/local/lib/python3.12/dist-packages (from langchain-core<2.0.0,>=1.2.8->langchain) (1.33)\n", "Requirement already satisfied: uuid-utils<1.0,>=0.12.0 in /usr/local/lib/python3.12/dist-packages (from langchain-core<2.0.0,>=1.2.8->langchain) (0.14.0)\n", "Requirement already satisfied: langgraph-checkpoint<5.0.0,>=2.1.0 in /usr/local/lib/python3.12/dist-packages (from langgraph<1.1.0,>=1.0.7->langchain) (4.0.0)\n", "Requirement already satisfied: langgraph-prebuilt<1.1.0,>=1.0.7 in /usr/local/lib/python3.12/dist-packages (from langgraph<1.1.0,>=1.0.7->langchain) (1.0.7)\n", "Requirement already satisfied: langgraph-sdk<0.4.0,>=0.3.0 in /usr/local/lib/python3.12/dist-packages (from langgraph<1.1.0,>=1.0.7->langchain) (0.3.3)\n", "Requirement already satisfied: xxhash>=3.5.0 in /usr/local/lib/python3.12/dist-packages (from langgraph<1.1.0,>=1.0.7->langchain) (3.6.0)\n", "Requirement already satisfied: requests-toolbelt>=1.0.0 in /usr/local/lib/python3.12/dist-packages (from langsmith<1.0.0,>=0.1.125->langchain-community) (1.0.0)\n", "Requirement already satisfied: zstandard>=0.23.0 in /usr/local/lib/python3.12/dist-packages (from langsmith<1.0.0,>=0.1.125->langchain-community) (0.25.0)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.12/dist-packages (from pandas<3.0,>=1.0->gradio) (2.9.0.post0)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas<3.0,>=1.0->gradio) (2025.2)\n", "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas<3.0,>=1.0->gradio) (2025.3)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.12/dist-packages (from pydantic<3.0.0,>=2.7.4->langchain) (0.7.0)\n", "Requirement already satisfied: pydantic-core==2.41.4 in /usr/local/lib/python3.12/dist-packages (from pydantic<3.0.0,>=2.7.4->langchain) (2.41.4)\n", "Requirement already satisfied: python-dotenv>=0.21.0 in /usr/local/lib/python3.12/dist-packages (from pydantic-settings<3.0.0,>=2.10.1->langchain-community) (1.2.1)\n", "Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests<3.0.0,>=2.32.5->langchain-community) (3.4.4)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests<3.0.0,>=2.32.5->langchain-community) (2.5.0)\n", "Requirement already satisfied: greenlet>=1 in /usr/local/lib/python3.12/dist-packages (from SQLAlchemy<3.0.0,>=1.4.0->langchain-community) (3.3.1)\n", "Requirement already satisfied: setuptools in /usr/local/lib/python3.12/dist-packages (from torch>=1.11.0->sentence-transformers) (75.2.0)\n", "Requirement already satisfied: sympy>=1.13.3 in /usr/local/lib/python3.12/dist-packages (from torch>=1.11.0->sentence-transformers) (1.14.0)\n", "Requirement already satisfied: networkx>=2.5.1 in /usr/local/lib/python3.12/dist-packages (from torch>=1.11.0->sentence-transformers) (3.6.1)\n", "Requirement already satisfied: click>=8.0.0 in /usr/local/lib/python3.12/dist-packages (from typer<1.0,>=0.12->gradio) (8.3.1)\n", "Requirement already satisfied: shellingham>=1.3.0 in /usr/local/lib/python3.12/dist-packages (from typer<1.0,>=0.12->gradio) (1.5.4)\n", "Requirement already satisfied: rich>=10.11.0 in /usr/local/lib/python3.12/dist-packages (from typer<1.0,>=0.12->gradio) (13.9.4)\n", "Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.12/dist-packages (from scikit-learn->sentence-transformers) (1.5.3)\n", "Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.12/dist-packages (from scikit-learn->sentence-transformers) (3.6.0)\n", "Requirement already satisfied: jsonpointer>=1.9 in /usr/local/lib/python3.12/dist-packages (from jsonpatch<2.0.0,>=1.33.0->langchain-core<2.0.0,>=1.2.8->langchain) (3.0.0)\n", "Requirement already satisfied: ormsgpack>=1.12.0 in /usr/local/lib/python3.12/dist-packages (from langgraph-checkpoint<5.0.0,>=2.1.0->langgraph<1.1.0,>=1.0.7->langchain) (1.12.2)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.12/dist-packages (from python-dateutil>=2.8.2->pandas<3.0,>=1.0->gradio) (1.17.0)\n", "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from rich>=10.11.0->typer<1.0,>=0.12->gradio) (4.0.0)\n", "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.12/dist-packages (from rich>=10.11.0->typer<1.0,>=0.12->gradio) (2.19.2)\n", "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from sympy>=1.13.3->torch>=1.11.0->sentence-transformers) (1.3.0)\n", "Collecting mypy-extensions>=0.3.0 (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7.0,>=0.6.7->langchain-community)\n", " Downloading mypy_extensions-1.1.0-py3-none-any.whl.metadata (1.1 kB)\n", "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.12/dist-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->typer<1.0,>=0.12->gradio) (0.1.2)\n", "Downloading langchain_community-0.4.1-py3-none-any.whl (2.5 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.5/2.5 MB\u001b[0m \u001b[31m34.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading langchain_huggingface-1.2.0-py3-none-any.whl (30 kB)\n", "Downloading faiss_cpu-1.13.2-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (23.8 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m23.8/23.8 MB\u001b[0m \u001b[31m60.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading transformers-4.57.6-py3-none-any.whl (12.0 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m12.0/12.0 MB\u001b[0m \u001b[31m93.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading pypdf-6.7.0-py3-none-any.whl (330 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m330.6/330.6 kB\u001b[0m \u001b[31m26.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading dataclasses_json-0.6.7-py3-none-any.whl (28 kB)\n", "Downloading huggingface_hub-0.36.2-py3-none-any.whl (566 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m566.4/566.4 kB\u001b[0m \u001b[31m36.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading langchain_classic-1.0.1-py3-none-any.whl (1.0 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m59.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading requests-2.32.5-py3-none-any.whl (64 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.7/64.7 kB\u001b[0m \u001b[31m5.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading langchain_text_splitters-1.1.0-py3-none-any.whl (34 kB)\n", "Downloading marshmallow-3.26.2-py3-none-any.whl (50 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m51.0/51.0 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n", "Downloading mypy_extensions-1.1.0-py3-none-any.whl (5.0 kB)\n", "Installing collected packages: requests, pypdf, mypy-extensions, marshmallow, faiss-cpu, typing-inspect, huggingface-hub, dataclasses-json, transformers, langchain-text-splitters, langchain-huggingface, langchain-classic, langchain-community\n", " Attempting uninstall: requests\n", " Found existing installation: requests 2.32.4\n", " Uninstalling requests-2.32.4:\n", " Successfully uninstalled requests-2.32.4\n", " Attempting uninstall: huggingface-hub\n", " Found existing installation: huggingface_hub 1.4.0\n", " Uninstalling huggingface_hub-1.4.0:\n", " Successfully uninstalled huggingface_hub-1.4.0\n", " Attempting uninstall: transformers\n", " Found existing installation: transformers 5.0.0\n", " Uninstalling transformers-5.0.0:\n", " Successfully uninstalled transformers-5.0.0\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "google-colab 1.0.0 requires requests==2.32.4, but you have requests 2.32.5 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0mSuccessfully installed dataclasses-json-0.6.7 faiss-cpu-1.13.2 huggingface-hub-0.36.2 langchain-classic-1.0.1 langchain-community-0.4.1 langchain-huggingface-1.2.0 langchain-text-splitters-1.1.0 marshmallow-3.26.2 mypy-extensions-1.1.0 pypdf-6.7.0 requests-2.32.5 transformers-4.57.6 typing-inspect-0.9.0\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "CUB_3MJ38i2K", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "8687b3e4-23d4-456e-d7ed-9ac2048aaab4" }, "execution_count": 8, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "WARNING:torchao.kernel.intmm:Warning: Detected no triton, on systems without Triton certain kernels will not work\n" ] } ] }, { "cell_type": "code", "source": [ "from langchain_community.document_loaders import PyPDFLoader\n", "\n", "loader = PyPDFLoader(\"ml_notes.pdf\")\n", "documents = loader.load()\n", "\n", "\n", "\n", "from langchain_text_splitters import RecursiveCharacterTextSplitter\n", "\n", "text_splitter = RecursiveCharacterTextSplitter(\n", " chunk_size=300,\n", " chunk_overlap=50\n", ")\n", "\n", "docs = text_splitter.split_documents(documents)\n", "len(docs)\n", "from langchain_huggingface import HuggingFaceEmbeddings\n", "\n", "embedding_model = HuggingFaceEmbeddings(\n", " model_name=\"sentence-transformers/all-MiniLM-L6-v2\"\n", ")\n", "\n", "from langchain_community.vectorstores import FAISS\n", "\n", "vectorstore = FAISS.from_documents(docs,\n", " embedding_model)\n", "retriever = vectorstore.as_retriever(\n", " search_kwargs={\"k\": 3})\n", "\n", "from transformers import pipeline\n", "from langchain_huggingface import HuggingFacePipeline\n", "\n", "\n", "\n", "from transformers import pipeline\n", "from langchain_huggingface import HuggingFacePipeline\n", "\n", "pipe = pipeline(\n", " \"text2text-generation\", # ✅ correct\n", " model=\"google/flan-t5-base\",\n", " max_new_tokens=200\n", ")\n", "\n", "llm = HuggingFacePipeline(pipeline=pipe)\n", "\n", "\n", "\n", "\n", "from langchain_core.prompts import ChatPromptTemplate\n", "from langchain_core.runnables import RunnablePassthrough\n", "from langchain_core.output_parsers import StrOutputParser\n", "prompt = ChatPromptTemplate.from_template(\n", " \"\"\"\n", " Answer the question using ONLY the context below.\n", " If the answer is not in the context, say \"I don't know\".\n", "\n", " Context:\n", " {context}\n", "\n", " Question:\n", " {question}\n", " \"\"\"\n", ")\n", "rag_chain = (\n", " {\n", " \"context\": retriever,\n", " \"question\": RunnablePassthrough()\n", " }\n", " | prompt\n", " | llm\n", " | StrOutputParser()\n", ")\n", "\n", "response = rag_chain.invoke(\"What is Transformers?\")\n", "print(response)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "tX3WCn5g812N", "outputId": "e3333242-4c24-42ce-cb68-3066c0b5ae1e" }, "execution_count": 12, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Device set to use cpu\n", "Token indices sequence length is longer than the specified maximum sequence length for this model (606 > 512). Running this sequence through the model will result in indexing errors\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "A field of AI that enables systems to learn from data.nSupervised learning uses labeled data.nUnsupervised learning finds hidden patterns.nGradient descent is an optimization algorithm.nNeural networks consist of layers of neurons.nTransformers use attention instead of recurrence.nRAG combines retrieval with generation.n\n" ] } ] }, { "cell_type": "code", "source": [ "response = rag_chain.invoke(\"What is Transformers?\")\n", "print(response)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "LTfX1vrzr9nA", "outputId": "ac0fd8ba-a9ef-4700-b3a4-c6a99c7a9ae4" }, "execution_count": 13, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "A field of AI that enables systems to learn from data.nSupervised learning uses labeled data.nUnsupervised learning finds hidden patterns.nGradient descent is an optimization algorithm.nNeural networks consist of layers of neurons.nTransformers use attention instead of recurrence.nRAG combines retrieval with generation.n\n" ] } ] }, { "cell_type": "code", "source": [ "response = rag_chain.invoke(\"What is RAG?\")\n", "print(response)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "qzB5lxsF4keU", "outputId": "8b3561e9-13ec-461e-dab2-0498a312baa8" }, "execution_count": 14, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "combines retrieval with generation\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "6-c_isoh4khw" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "Ag4RWu3H83ui" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "from langchain_community.document_loaders import PyPDFLoader\n", "#Load PDF\n", "loader = PyPDFLoader(\"ml_notes.pdf\")\n", "documents = loader.load()\n", "\n", "documents[:1]\n", "\n", "#Split text into chunks\n", "from langchain_text_splitters import RecursiveCharacterTextSplitter\n", "\n", "text_splitter = RecursiveCharacterTextSplitter(\n", " chunk_size=200,\n", " chunk_overlap=30\n", ")\n", "\n", "docs = text_splitter.split_documents(documents)\n", "print(\"Number of chunks:\", len(docs))\n", "\n", "#Create embeddings\n", "from langchain_huggingface import HuggingFaceEmbeddings\n", "\n", "embedding_model = HuggingFaceEmbeddings(\n", " model_name=\"sentence-transformers/all-MiniLM-L6-v2\"\n", ")\n", "\n", "#Store embeddings in FAISS\n", "from langchain_community.vectorstores import FAISS\n", "\n", "vectorstore = FAISS.from_documents(docs, embedding_model)\n", "retriever = vectorstore.as_retriever(search_kwargs={\"k\": 2})\n", "\n", "#Load LLM (CORRECT pipeline for FLAN-T5)\n", "from transformers import pipeline\n", "from langchain_huggingface import HuggingFacePipeline\n", "\n", "pipe = pipeline(\n", " \"text2text-generation\", # ✅ correct for T5\n", " model=\"google/flan-t5-base\",\n", " max_new_tokens=200\n", ")\n", "\n", "llm = HuggingFacePipeline(pipeline=pipe)\n", "\n", "#Build RAG chain (MODERN LCEL – no deprecated APIs)\n", "from langchain_core.prompts import ChatPromptTemplate\n", "from langchain_core.runnables import RunnablePassthrough\n", "from langchain_core.output_parsers import StrOutputParser\n", "\n", "prompt = ChatPromptTemplate.from_template(\n", " \"\"\"\n", " Answer the question using ONLY the context below.\n", " If the answer is not in the context, say \"I don't know\".\n", "\n", " Context:\n", " {context}\n", "\n", " Question:\n", " {question}\n", " \"\"\"\n", ")\n", "\n", "rag_chain = (\n", " {\n", " \"context\": retriever,\n", " \"question\": RunnablePassthrough()\n", " }\n", " | prompt\n", " | llm\n", " | StrOutputParser()\n", ")\n", "\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "zaPkyKSj-xHB", "outputId": "34f5a5f3-65ad-4a38-d324-611f2ac33b2a" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Number of chunks: 2\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "Device set to use cpu\n" ] } ] }, { "cell_type": "code", "source": [ "response = rag_chain.invoke(\"What is RAG?\")\n", "print(response)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "lmsKGspG-xJW", "outputId": "d5c0cd1d-1e6a-48e5-d1f0-9a3781c13d98" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Token indices sequence length is longer than the specified maximum sequence length for this model (590 > 512). Running this sequence through the model will result in indexing errors\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "combines retrieval with generation\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "vO3DOsvc-xLd" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "import gradio as gr\n", "\n", "def chat(question):\n", " return rag_chain.invoke(question)\n", "\n", "interface = gr.Interface(\n", " fn=chat,\n", " inputs=gr.Textbox(lines=2, placeholder=\"Ask from the PDF...\"),\n", " outputs=\"text\",\n", " title=\"📚 RAG PDF Chatbot\",\n", " description=\"Ask questions grounded in your PDF using RAG\"\n", ")\n", "\n", "interface.launch()\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 649 }, "id": "iAOqpptG_Vj3", "outputId": "09f0d4e0-d313-4073-ba9a-862c1388c581" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "It looks like you are running Gradio on a hosted Jupyter notebook, which requires `share=True`. Automatically setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n", "\n", "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n", "* Running on public URL: https://5cc340826956ac0c3c.gradio.live\n", "\n", "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/html": [ "
" ] }, "metadata": {} }, { "output_type": "execute_result", "data": { "text/plain": [] }, "metadata": {}, "execution_count": 22 } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "ByaaHqpi_7Ov" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "%%writefile app.py\n", "# =========================\n", "# RAG PDF Chatbot - app.py\n", "# =========================\n", "\n", "import gradio as gr\n", "\n", "from langchain_community.document_loaders import PyPDFLoader\n", "from langchain_text_splitters import RecursiveCharacterTextSplitter\n", "from langchain_huggingface import HuggingFaceEmbeddings, HuggingFacePipeline\n", "from langchain_community.vectorstores import FAISS\n", "\n", "from transformers import pipeline\n", "from langchain_core.prompts import ChatPromptTemplate\n", "from langchain_core.runnables import RunnablePassthrough\n", "from langchain_core.output_parsers import StrOutputParser\n", "\n", "\n", "# --------- Load PDF ---------\n", "PDF_PATH = \"ml_notes.pdf\"\n", "\n", "loader = PyPDFLoader(PDF_PATH)\n", "documents = loader.load()\n", "\n", "\n", "# --------- Split Text ---------\n", "text_splitter = RecursiveCharacterTextSplitter(\n", " chunk_size=200,\n", " chunk_overlap=30\n", ")\n", "docs = text_splitter.split_documents(documents)\n", "\n", "\n", "# --------- Embeddings ---------\n", "embedding_model = HuggingFaceEmbeddings(\n", " model_name=\"sentence-transformers/all-MiniLM-L6-v2\"\n", ")\n", "\n", "\n", "# --------- Vector Store ---------\n", "vectorstore = FAISS.from_documents(docs, embedding_model)\n", "retriever = vectorstore.as_retriever(search_kwargs={\"k\": 2})\n", "\n", "\n", "# --------- LLM (FLAN-T5) ---------\n", "pipe = pipeline(\n", " \"text2text-generation\",\n", " model=\"google/flan-t5-base\",\n", " max_new_tokens=200\n", ")\n", "llm = HuggingFacePipeline(pipeline=pipe)\n", "\n", "\n", "# --------- Prompt ---------\n", "prompt = ChatPromptTemplate.from_template(\n", " \"\"\"\n", " Answer the question using ONLY the context below.\n", " If the answer is not in the context, say \"I don't know\".\n", "\n", " Context:\n", " {context}\n", "\n", " Question:\n", " {question}\n", " \"\"\"\n", ")\n", "\n", "\n", "# --------- RAG Chain ---------\n", "rag_chain = (\n", " {\n", " \"context\": retriever,\n", " \"question\": RunnablePassthrough()\n", " }\n", " | prompt\n", " | llm\n", " | StrOutputParser()\n", ")\n", "\n", "\n", "# --------- Gradio UI ---------\n", "def chat(question):\n", " return rag_chain.invoke(question)\n", "\n", "\n", "demo = gr.Interface(\n", " fn=chat,\n", " inputs=gr.Textbox(lines=2, placeholder=\"Ask from the PDF...\"),\n", " outputs=\"text\",\n", " title=\"📚 RAG PDF Chatbot\",\n", " description=\"Ask questions grounded in your PDF using RAG\"\n", ")\n", "\n", "demo.launch()\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "_yNOJZk7_7Ra", "outputId": "66fbff25-e737-4e0c-a526-93becba4914f" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Overwriting app.py\n" ] } ] }, { "cell_type": "code", "source": [ "%%writefile requirements.txt\n", "langchain\n", "langchain-community\n", "langchain-huggingface\n", "langchain-text-splitters\n", "sentence-transformers\n", "faiss-cpu\n", "transformers\n", "pypdf\n", "gradio\n", "torch\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RtmcCaNx_7T0", "outputId": "9ca9a288-5ca0-4b87-de83-2fc26330015c" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Writing requirements.txt\n" ] } ] }, { "cell_type": "code", "source": [ "from google.colab import files\n", "\n", "files.download(\"app.py\")\n", "files.download(\"requirements.txt\")\n", "files.download(\"ml_notes.pdf\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 17 }, "id": "j-9CT7FF_7XU", "outputId": "f0ac1f6a-8c27-4a69-893f-c28b2bfe3433" }, "execution_count": null, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "" ], "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_a06eabf9-a2d9-4e33-b5ee-9defc3487573\", \"app.py\", 2104)" ] }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "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_92fe3085-52da-42ea-9f10-2b6c70d25d20\", \"requirements.txt\", 141)" ] }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "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_53138f85-de77-4322-ac5b-55c5244510e4\", \"ml_notes.pdf\", 1605)" ] }, "metadata": {} } ] }, { "cell_type": "code", "source": [ "#https://huggingface.co/spaces" ], "metadata": { "id": "XDEb1aTK-xNo" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Click Create new Space\n", "\n", "# SDK: Gradio\n", "\n", "# Language: Python\n", "\n", "# Space name: anything you like\n", "#create space\n", "\n", "## click on files\n", "\n", "# Look at the top-right of your screen 👀\n", "# You will see a button:\n", "\n", "# ➕ Contribute ⬇️\n", "\n", "\n", "# STEP 1: Wait for the build (most important)\n", "\n", "# Right after you commit the files, Hugging Face will:\n", "\n", "# Install packages from requirements.txt\n", "\n", "# Load the model + embeddings\n", "\n", "# What you should see\n", "\n", "# At the top of the Space page:\n", "\n", "# ⏳ Building (yellow/orange)\n", "\n", "# then ✅ Running (green)\n", "\n", "# ⏱️ First build usually takes 2–5 minutes (model download)." ], "metadata": { "id": "c_m2B_7e-xRI" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# https://huggingface.co/spaces/AtmaKaumr/test/tree/main" ], "metadata": { "id": "HN18h_Bz87Mm" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# https://huggingface.co/spaces/AtmaKaumr/test" ], "metadata": { "id": "V5WJaX6A8-b1" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# ✅ How to STOP your Hugging Face Space\n", "# 🔹 Method 1 (Recommended)\n", "\n", "# 1️⃣ Go to your Space page\n", "# 2️⃣ Click the Settings tab (top-right, next to Community)\n", "# 3️⃣ Scroll down to Runtime section\n", "# 4️⃣ Click “Stop this Space”" ], "metadata": { "id": "eOg00-PY9Gob" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "Kvyra7vo9Gq4" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "vjtZ9qVM9GuU" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "m-5Mj_I79zX7" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "47zMqyFO91DP" }, "execution_count": null, "outputs": [] } ] }