File size: 109,725 Bytes
9258c8a
1
{"cells":[{"cell_type":"markdown","id":"04815d1b-44ee-4bd3-878e-fa0c3bf9fa7f","metadata":{"tags":[],"id":"04815d1b-44ee-4bd3-878e-fa0c3bf9fa7f"},"source":["# LangChain QA Panel App\n","\n","This notebook shows how to make this app:"]},{"cell_type":"code","execution_count":9,"id":"a181568b-9cde-4a55-a853-4d2a41dbfdad","metadata":{"tags":[],"colab":{"base_uri":"https://localhost:8080/"},"id":"a181568b-9cde-4a55-a853-4d2a41dbfdad","executionInfo":{"status":"ok","timestamp":1683001185226,"user_tz":240,"elapsed":8968,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}},"outputId":"1680c9fc-4a81-4ac8-e3ce-f8724d59ed6c"},"outputs":[{"output_type":"stream","name":"stdout","text":["Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: langchain in /usr/local/lib/python3.10/dist-packages (0.0.154)\n","Requirement already satisfied: openai in /usr/local/lib/python3.10/dist-packages (0.27.6)\n","Requirement already satisfied: chromadb in /usr/local/lib/python3.10/dist-packages (0.3.21)\n","Requirement already satisfied: tiktoken in /usr/local/lib/python3.10/dist-packages (0.3.3)\n","Requirement already satisfied: pypdf in /usr/local/lib/python3.10/dist-packages (3.8.1)\n","Requirement already satisfied: panel in /usr/local/lib/python3.10/dist-packages (0.14.4)\n","Requirement already satisfied: PyYAML>=5.4.1 in /usr/local/lib/python3.10/dist-packages (from langchain) (6.0)\n","Requirement already satisfied: SQLAlchemy<3,>1.4 in /usr/local/lib/python3.10/dist-packages (from langchain) (2.0.10)\n","Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /usr/local/lib/python3.10/dist-packages (from langchain) (3.8.4)\n","Requirement already satisfied: async-timeout<5.0.0,>=4.0.0 in /usr/local/lib/python3.10/dist-packages (from langchain) (4.0.2)\n","Requirement already satisfied: dataclasses-json<0.6.0,>=0.5.7 in /usr/local/lib/python3.10/dist-packages (from langchain) (0.5.7)\n","Requirement already satisfied: numexpr<3.0.0,>=2.8.4 in /usr/local/lib/python3.10/dist-packages (from langchain) (2.8.4)\n","Requirement already satisfied: numpy<2,>=1 in /usr/local/lib/python3.10/dist-packages (from langchain) (1.22.4)\n","Requirement already satisfied: openapi-schema-pydantic<2.0,>=1.2 in /usr/local/lib/python3.10/dist-packages (from langchain) (1.2.4)\n","Requirement already satisfied: pydantic<2,>=1 in /usr/local/lib/python3.10/dist-packages (from langchain) (1.10.7)\n","Requirement already satisfied: requests<3,>=2 in /usr/local/lib/python3.10/dist-packages (from langchain) (2.29.0)\n","Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /usr/local/lib/python3.10/dist-packages (from langchain) (8.2.2)\n","Requirement already satisfied: tqdm>=4.48.0 in /usr/local/lib/python3.10/dist-packages (from langchain) (4.65.0)\n","Requirement already satisfied: pandas>=1.3 in /usr/local/lib/python3.10/dist-packages (from chromadb) (1.5.3)\n","Requirement already satisfied: hnswlib>=0.7 in /usr/local/lib/python3.10/dist-packages (from chromadb) (0.7.0)\n","Requirement already satisfied: clickhouse-connect>=0.5.7 in /usr/local/lib/python3.10/dist-packages (from chromadb) (0.5.22)\n","Requirement already satisfied: sentence-transformers>=2.2.2 in /usr/local/lib/python3.10/dist-packages (from chromadb) (2.2.2)\n","Requirement already satisfied: duckdb>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from chromadb) (0.7.1)\n","Requirement already satisfied: fastapi>=0.85.1 in /usr/local/lib/python3.10/dist-packages (from chromadb) (0.95.1)\n","Requirement already satisfied: uvicorn[standard]>=0.18.3 in /usr/local/lib/python3.10/dist-packages (from chromadb) (0.22.0)\n","Requirement already satisfied: posthog>=2.4.0 in /usr/local/lib/python3.10/dist-packages (from chromadb) (3.0.1)\n","Requirement already satisfied: regex>=2022.1.18 in /usr/local/lib/python3.10/dist-packages (from tiktoken) (2022.10.31)\n","Requirement already satisfied: bokeh<2.5.0,>=2.4.0 in /usr/local/lib/python3.10/dist-packages (from panel) (2.4.3)\n","Requirement already satisfied: param>=1.12.0 in /usr/local/lib/python3.10/dist-packages (from panel) (1.13.0)\n","Requirement already satisfied: pyviz-comms>=0.7.4 in /usr/local/lib/python3.10/dist-packages (from panel) (2.2.1)\n","Requirement already satisfied: markdown in /usr/local/lib/python3.10/dist-packages (from panel) (3.4.3)\n","Requirement already satisfied: pyct>=0.4.4 in /usr/local/lib/python3.10/dist-packages (from panel) (0.5.0)\n","Requirement already satisfied: bleach in /usr/local/lib/python3.10/dist-packages (from panel) (6.0.0)\n","Requirement already satisfied: setuptools>=42 in /usr/local/lib/python3.10/dist-packages (from panel) (67.7.2)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from panel) (4.5.0)\n","Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (23.1.0)\n","Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (2.0.12)\n","Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (6.0.4)\n","Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.9.2)\n","Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.3)\n","Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.1)\n","Requirement already satisfied: Jinja2>=2.9 in /usr/local/lib/python3.10/dist-packages (from bokeh<2.5.0,>=2.4.0->panel) (3.1.2)\n","Requirement already satisfied: packaging>=16.8 in /usr/local/lib/python3.10/dist-packages (from bokeh<2.5.0,>=2.4.0->panel) (23.1)\n","Requirement already satisfied: pillow>=7.1.0 in /usr/local/lib/python3.10/dist-packages (from bokeh<2.5.0,>=2.4.0->panel) (8.4.0)\n","Requirement already satisfied: tornado>=5.1 in /usr/local/lib/python3.10/dist-packages (from bokeh<2.5.0,>=2.4.0->panel) (6.2)\n","Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from clickhouse-connect>=0.5.7->chromadb) (2022.12.7)\n","Requirement already satisfied: urllib3>=1.26 in /usr/local/lib/python3.10/dist-packages (from clickhouse-connect>=0.5.7->chromadb) (1.26.15)\n","Requirement already satisfied: pytz in /usr/local/lib/python3.10/dist-packages (from clickhouse-connect>=0.5.7->chromadb) (2022.7.1)\n","Requirement already satisfied: zstandard in /usr/local/lib/python3.10/dist-packages (from clickhouse-connect>=0.5.7->chromadb) (0.21.0)\n","Requirement already satisfied: lz4 in /usr/local/lib/python3.10/dist-packages (from clickhouse-connect>=0.5.7->chromadb) (4.3.2)\n","Requirement already satisfied: marshmallow<4.0.0,>=3.3.0 in /usr/local/lib/python3.10/dist-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (3.19.0)\n","Requirement already satisfied: marshmallow-enum<2.0.0,>=1.5.1 in /usr/local/lib/python3.10/dist-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (1.5.1)\n","Requirement already satisfied: typing-inspect>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (0.8.0)\n","Requirement already satisfied: starlette<0.27.0,>=0.26.1 in /usr/local/lib/python3.10/dist-packages (from fastapi>=0.85.1->chromadb) (0.26.1)\n","Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.3->chromadb) (2.8.2)\n","Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from posthog>=2.4.0->chromadb) (1.16.0)\n","Requirement already satisfied: monotonic>=1.5 in /usr/local/lib/python3.10/dist-packages (from posthog>=2.4.0->chromadb) (1.6)\n","Requirement already satisfied: backoff>=1.10.0 in /usr/local/lib/python3.10/dist-packages (from posthog>=2.4.0->chromadb) (2.2.1)\n","Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2->langchain) (3.4)\n","Requirement already satisfied: transformers<5.0.0,>=4.6.0 in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (4.28.1)\n","Requirement already satisfied: torch>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (2.0.0+cu118)\n","Requirement already satisfied: torchvision in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (0.15.1+cu118)\n","Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (1.2.2)\n","Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (1.10.1)\n","Requirement already satisfied: nltk in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (3.8.1)\n","Requirement already satisfied: sentencepiece in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (0.1.98)\n","Requirement already satisfied: huggingface-hub>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from sentence-transformers>=2.2.2->chromadb) (0.14.1)\n","Requirement already satisfied: greenlet!=0.4.17 in /usr/local/lib/python3.10/dist-packages (from SQLAlchemy<3,>1.4->langchain) (2.0.2)\n","Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (8.1.3)\n","Requirement already satisfied: h11>=0.8 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.14.0)\n","Requirement already satisfied: httptools>=0.5.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.5.0)\n","Requirement already satisfied: python-dotenv>=0.13 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (1.0.0)\n","Requirement already satisfied: uvloop!=0.15.0,!=0.15.1,>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.17.0)\n","Requirement already satisfied: watchfiles>=0.13 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.19.0)\n","Requirement already satisfied: websockets>=10.4 in /usr/local/lib/python3.10/dist-packages (from uvicorn[standard]>=0.18.3->chromadb) (11.0.2)\n","Requirement already satisfied: webencodings in /usr/local/lib/python3.10/dist-packages (from bleach->panel) (0.5.1)\n","Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers>=2.2.2->chromadb) (3.12.0)\n","Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers>=2.2.2->chromadb) (2023.4.0)\n","Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.9->bokeh<2.5.0,>=2.4.0->panel) (2.1.2)\n","Requirement already satisfied: anyio<5,>=3.4.0 in /usr/local/lib/python3.10/dist-packages (from starlette<0.27.0,>=0.26.1->fastapi>=0.85.1->chromadb) (3.6.2)\n","Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (1.11.1)\n","Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (3.1)\n","Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (2.0.0)\n","Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (3.25.2)\n","Requirement already satisfied: lit in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (16.0.2)\n","Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.6.0->sentence-transformers>=2.2.2->chromadb) (0.13.3)\n","Requirement already satisfied: mypy-extensions>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from typing-inspect>=0.4.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (1.0.0)\n","Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk->sentence-transformers>=2.2.2->chromadb) (1.2.0)\n","Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->sentence-transformers>=2.2.2->chromadb) (3.1.0)\n","Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.10/dist-packages (from anyio<5,>=3.4.0->starlette<0.27.0,>=0.26.1->fastapi>=0.85.1->chromadb) (1.3.0)\n","Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (1.3.0)\n"]}],"source":["!pip install langchain openai chromadb tiktoken pypdf panel\n"]},{"cell_type":"code","execution_count":10,"id":"9a464409-d064-4766-a9cb-5119f6c4b8f5","metadata":{"tags":[],"id":"9a464409-d064-4766-a9cb-5119f6c4b8f5","executionInfo":{"status":"ok","timestamp":1683001185230,"user_tz":240,"elapsed":147,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["import os \n","from langchain.chains import RetrievalQA\n","from langchain.llms import OpenAI\n","from langchain.document_loaders import TextLoader\n","from langchain.document_loaders import PyPDFLoader\n","from langchain.indexes import VectorstoreIndexCreator\n","from langchain.text_splitter import CharacterTextSplitter\n","from langchain.embeddings import OpenAIEmbeddings\n","from langchain.vectorstores import Chroma\n","import panel as pn\n","import tempfile\n"]},{"cell_type":"code","execution_count":11,"id":"b2d07ea5-9ff2-4c96-a8dc-92895d870b73","metadata":{"tags":[],"colab":{"base_uri":"https://localhost:8080/","height":17},"id":"b2d07ea5-9ff2-4c96-a8dc-92895d870b73","executionInfo":{"status":"ok","timestamp":1683001185232,"user_tz":240,"elapsed":145,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}},"outputId":"e5b43ffe-f3a4-4412-da0e-bd5cb6e63e81"},"outputs":[{"output_type":"display_data","data":{"application/javascript":["(function(root) {\n","  function now() {\n","    return new Date();\n","  }\n","\n","  var force = true;\n","\n","  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n","    root._bokeh_onload_callbacks = [];\n","    root._bokeh_is_loading = undefined;\n","  }\n","\n","  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n","    root._bokeh_timeout = Date.now() + 5000;\n","    root._bokeh_failed_load = false;\n","  }\n","\n","  function run_callbacks() {\n","    try {\n","      root._bokeh_onload_callbacks.forEach(function(callback) {\n","        if (callback != null)\n","          callback();\n","      });\n","    } finally {\n","      delete root._bokeh_onload_callbacks\n","    }\n","    console.debug(\"Bokeh: all callbacks have finished\");\n","  }\n","\n","  function load_libs(css_urls, js_urls, js_modules, callback) {\n","    if (css_urls == null) css_urls = [];\n","    if (js_urls == null) js_urls = [];\n","    if (js_modules == null) js_modules = [];\n","\n","    root._bokeh_onload_callbacks.push(callback);\n","    if (root._bokeh_is_loading > 0) {\n","      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n","      return null;\n","    }\n","    if (js_urls.length === 0 && js_modules.length === 0) {\n","      run_callbacks();\n","      return null;\n","    }\n","    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n","\n","    function on_load() {\n","      root._bokeh_is_loading--;\n","      if (root._bokeh_is_loading === 0) {\n","        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n","        run_callbacks()\n","      }\n","    }\n","\n","    function on_error() {\n","      console.error(\"failed to load \" + url);\n","    }\n","\n","    for (var i = 0; i < css_urls.length; i++) {\n","      var url = css_urls[i];\n","      const element = document.createElement(\"link\");\n","      element.onload = on_load;\n","      element.onerror = on_error;\n","      element.rel = \"stylesheet\";\n","      element.type = \"text/css\";\n","      element.href = url;\n","      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n","      document.body.appendChild(element);\n","    }\n","\n","    var skip = [];\n","    if (window.requirejs) {\n","      window.requirejs.config({'packages': {}, 'paths': {'Quill': 'https://cdn.quilljs.com/1.3.6/quill', 'gridstack': 'https://cdn.jsdelivr.net/npm/gridstack@4.2.5/dist/gridstack-h5', 'notyf': 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min'}, 'shim': {'gridstack': {'exports': 'GridStack'}}});\n","      require([\"Quill\"], function(Quill) {\n","\twindow.Quill = Quill\n","\ton_load()\n","      })\n","      require([\"gridstack\"], function(GridStack) {\n","\twindow.GridStack = GridStack\n","\ton_load()\n","      })\n","      require([\"notyf\"], function() {\n","\ton_load()\n","      })\n","      root._bokeh_is_loading = css_urls.length + 3;\n","    } else {\n","      root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n","    }    if (((window['Quill'] !== undefined) && (!(window['Quill'] instanceof HTMLElement))) || window.requirejs) {\n","      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js'];\n","      for (var i = 0; i < urls.length; i++) {\n","        skip.push(urls[i])\n","      }\n","    }    if (((window['GridStack'] !== undefined) && (!(window['GridStack'] instanceof HTMLElement))) || window.requirejs) {\n","      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/gridstack/gridstack@4.2.5/dist/gridstack-h5.js'];\n","      for (var i = 0; i < urls.length; i++) {\n","        skip.push(urls[i])\n","      }\n","    }    if (((window['Notyf'] !== undefined) && (!(window['Notyf'] instanceof HTMLElement))) || window.requirejs) {\n","      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/notificationarea/notyf@3/notyf.min.js'];\n","      for (var i = 0; i < urls.length; i++) {\n","        skip.push(urls[i])\n","      }\n","    }    for (var i = 0; i < js_urls.length; i++) {\n","      var url = js_urls[i];\n","      if (skip.indexOf(url) >= 0) {\n","\tif (!window.requirejs) {\n","\t  on_load();\n","\t}\n","\tcontinue;\n","      }\n","      var element = document.createElement('script');\n","      element.onload = on_load;\n","      element.onerror = on_error;\n","      element.async = false;\n","      element.src = url;\n","      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n","      document.head.appendChild(element);\n","    }\n","    for (var i = 0; i < js_modules.length; i++) {\n","      var url = js_modules[i];\n","      if (skip.indexOf(url) >= 0) {\n","\tif (!window.requirejs) {\n","\t  on_load();\n","\t}\n","\tcontinue;\n","      }\n","      var element = document.createElement('script');\n","      element.onload = on_load;\n","      element.onerror = on_error;\n","      element.async = false;\n","      element.src = url;\n","      element.type = \"module\";\n","      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n","      document.head.appendChild(element);\n","    }\n","    if (!js_urls.length && !js_modules.length) {\n","      on_load()\n","    }\n","  };\n","\n","  function inject_raw_css(css) {\n","    const element = document.createElement(\"style\");\n","    element.appendChild(document.createTextNode(css));\n","    document.body.appendChild(element);\n","  }\n","\n","  var js_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\", \"https://unpkg.com/@holoviz/panel@0.14.4/dist/panel.min.js\"];\n","  var js_modules = [];\n","  var css_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.bubble.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.snow.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/card.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/loading.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/json.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/debugger.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/widgets.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/markdown.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/dataframe.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/alerts.css\"];\n","  var inline_js = [    function(Bokeh) {\n","      inject_raw_css(\"\\n    .bk.pn-loading.arc:before {\\n      background-image: url(\\\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXJnaW46IGF1dG87IGJhY2tncm91bmQ6IG5vbmU7IGRpc3BsYXk6IGJsb2NrOyBzaGFwZS1yZW5kZXJpbmc6IGF1dG87IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYzNjM2MzIiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij4gICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjFzIiB2YWx1ZXM9IjAgNTAgNTA7MzYwIDUwIDUwIiBrZXlUaW1lcz0iMDsxIj48L2FuaW1hdGVUcmFuc2Zvcm0+ICA8L2NpcmNsZT48L3N2Zz4=\\\");\\n      background-size: auto calc(min(50%, 400px));\\n    }\\n    \");\n","    },    function(Bokeh) {\n","      Bokeh.set_log_level(\"info\");\n","    },\n","function(Bokeh) {} // ensure no trailing comma for IE\n","  ];\n","\n","  function run_inline_js() {\n","    if ((root.Bokeh !== undefined) || (force === true)) {\n","      for (var i = 0; i < inline_js.length; i++) {\n","        inline_js[i].call(root, root.Bokeh);\n","      }} else if (Date.now() < root._bokeh_timeout) {\n","      setTimeout(run_inline_js, 100);\n","    } else if (!root._bokeh_failed_load) {\n","      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n","      root._bokeh_failed_load = true;\n","    }\n","  }\n","\n","  if (root._bokeh_is_loading === 0) {\n","    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n","    run_inline_js();\n","  } else {\n","    load_libs(css_urls, js_urls, js_modules, function() {\n","      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n","      run_inline_js();\n","    });\n","  }\n","}(window));"],"application/vnd.holoviews_load.v0+json":"(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, js_modules, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n    if (js_modules == null) js_modules = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls.length === 0 && js_modules.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    var skip = [];\n    if (window.requirejs) {\n      window.requirejs.config({'packages': {}, 'paths': {'Quill': 'https://cdn.quilljs.com/1.3.6/quill', 'gridstack': 'https://cdn.jsdelivr.net/npm/gridstack@4.2.5/dist/gridstack-h5', 'notyf': 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min'}, 'shim': {'gridstack': {'exports': 'GridStack'}}});\n      require([\"Quill\"], function(Quill) {\n\twindow.Quill = Quill\n\ton_load()\n      })\n      require([\"gridstack\"], function(GridStack) {\n\twindow.GridStack = GridStack\n\ton_load()\n      })\n      require([\"notyf\"], function() {\n\ton_load()\n      })\n      root._bokeh_is_loading = css_urls.length + 3;\n    } else {\n      root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n    }    if (((window['Quill'] !== undefined) && (!(window['Quill'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    if (((window['GridStack'] !== undefined) && (!(window['GridStack'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/gridstack/gridstack@4.2.5/dist/gridstack-h5.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    if (((window['Notyf'] !== undefined) && (!(window['Notyf'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/notificationarea/notyf@3/notyf.min.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      if (skip.indexOf(url) >= 0) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n    for (var i = 0; i < js_modules.length; i++) {\n      var url = js_modules[i];\n      if (skip.indexOf(url) >= 0) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      element.type = \"module\";\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n    if (!js_urls.length && !js_modules.length) {\n      on_load()\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  var js_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\", \"https://unpkg.com/@holoviz/panel@0.14.4/dist/panel.min.js\"];\n  var js_modules = [];\n  var css_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.bubble.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.snow.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/card.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/loading.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/json.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/debugger.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/widgets.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/markdown.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/dataframe.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/alerts.css\"];\n  var inline_js = [    function(Bokeh) {\n      inject_raw_css(\"\\n    .bk.pn-loading.arc:before {\\n      background-image: url(\\\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXJnaW46IGF1dG87IGJhY2tncm91bmQ6IG5vbmU7IGRpc3BsYXk6IGJsb2NrOyBzaGFwZS1yZW5kZXJpbmc6IGF1dG87IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYzNjM2MzIiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij4gICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjFzIiB2YWx1ZXM9IjAgNTAgNTA7MzYwIDUwIDUwIiBrZXlUaW1lcz0iMDsxIj48L2FuaW1hdGVUcmFuc2Zvcm0+ICA8L2NpcmNsZT48L3N2Zz4=\\\");\\n      background-size: auto calc(min(50%, 400px));\\n    }\\n    \");\n    },    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n  ];\n\n  function run_inline_js() {\n    if ((root.Bokeh !== undefined) || (force === true)) {\n      for (var i = 0; i < inline_js.length; i++) {\n        inline_js[i].call(root, root.Bokeh);\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    }\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, js_modules, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"},"metadata":{}},{"output_type":"display_data","data":{"application/vnd.holoviews_load.v0+json":"\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n  window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n    function JupyterCommManager() {\n    }\n\n    JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n      if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n        comm_manager.register_target(comm_id, function(comm) {\n          comm.on_msg(msg_handler);\n        });\n      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n        window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n          comm.onMsg = msg_handler;\n        });\n      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n        google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n          var messages = comm.messages[Symbol.asyncIterator]();\n          function processIteratorResult(result) {\n            var message = result.value;\n            console.log(message)\n            var content = {data: message.data, comm_id};\n            var buffers = []\n            for (var buffer of message.buffers || []) {\n              buffers.push(new DataView(buffer))\n            }\n            var metadata = message.metadata || {};\n            var msg = {content, buffers, metadata}\n            msg_handler(msg);\n            return messages.next().then(processIteratorResult);\n          }\n          return messages.next().then(processIteratorResult);\n        })\n      }\n    }\n\n    JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n      if (comm_id in window.PyViz.comms) {\n        return window.PyViz.comms[comm_id];\n      } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n        var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n        if (msg_handler) {\n          comm.on_msg(msg_handler);\n        }\n      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n        var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n        comm.open();\n        if (msg_handler) {\n          comm.onMsg = msg_handler;\n        }\n      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n        var comm_promise = google.colab.kernel.comms.open(comm_id)\n        comm_promise.then((comm) => {\n          window.PyViz.comms[comm_id] = comm;\n          if (msg_handler) {\n            var messages = comm.messages[Symbol.asyncIterator]();\n            function processIteratorResult(result) {\n              var message = result.value;\n              var content = {data: message.data};\n              var metadata = message.metadata || {comm_id};\n              var msg = {content, metadata}\n              msg_handler(msg);\n              return messages.next().then(processIteratorResult);\n            }\n            return messages.next().then(processIteratorResult);\n          }\n        }) \n        var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n          return comm_promise.then((comm) => {\n            comm.send(data, metadata, buffers, disposeOnDone);\n          });\n        };\n        var comm = {\n          send: sendClosure\n        };\n      }\n      window.PyViz.comms[comm_id] = comm;\n      return comm;\n    }\n    window.PyViz.comm_manager = new JupyterCommManager();\n    \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n  var div = document.createElement(\"div\");\n  var script = document.createElement(\"script\");\n  node.appendChild(div);\n  node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n  var output_area = handle.output_area;\n  var output = handle.output;\n  if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n    return\n  }\n  var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n  var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n  if (id !== undefined) {\n    var nchildren = toinsert.length;\n    var html_node = toinsert[nchildren-1].children[0];\n    html_node.innerHTML = output.data[HTML_MIME_TYPE];\n    var scripts = [];\n    var nodelist = html_node.querySelectorAll(\"script\");\n    for (var i in nodelist) {\n      if (nodelist.hasOwnProperty(i)) {\n        scripts.push(nodelist[i])\n      }\n    }\n\n    scripts.forEach( function (oldScript) {\n      var newScript = document.createElement(\"script\");\n      var attrs = [];\n      var nodemap = oldScript.attributes;\n      for (var j in nodemap) {\n        if (nodemap.hasOwnProperty(j)) {\n          attrs.push(nodemap[j])\n        }\n      }\n      attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n      newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n      oldScript.parentNode.replaceChild(newScript, oldScript);\n    });\n    if (JS_MIME_TYPE in output.data) {\n      toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n    }\n    output_area._hv_plot_id = id;\n    if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n      window.PyViz.plot_index[id] = Bokeh.index[id];\n    } else {\n      window.PyViz.plot_index[id] = null;\n    }\n  } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n    var bk_div = document.createElement(\"div\");\n    bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n    var script_attrs = bk_div.children[0].attributes;\n    for (var i = 0; i < script_attrs.length; i++) {\n      toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n    }\n    // store reference to server id on output_area\n    output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n  }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n  var id = handle.cell.output_area._hv_plot_id;\n  var server_id = handle.cell.output_area._bokeh_server_id;\n  if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n  var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n  if (server_id !== null) {\n    comm.send({event_type: 'server_delete', 'id': server_id});\n    return;\n  } else if (comm !== null) {\n    comm.send({event_type: 'delete', 'id': id});\n  }\n  delete PyViz.plot_index[id];\n  if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n    var doc = window.Bokeh.index[id].model.document\n    doc.clear();\n    const i = window.Bokeh.documents.indexOf(doc);\n    if (i > -1) {\n      window.Bokeh.documents.splice(i, 1);\n    }\n  }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n  delete PyViz.comms[\"hv-extension-comm\"];\n  window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n  handle_clear_output(event, {cell: {output_area: handle.output_area}})\n  handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n  function append_mime(data, metadata, element) {\n    // create a DOM node to render to\n    var toinsert = this.create_output_subarea(\n    metadata,\n    CLASS_NAME,\n    EXEC_MIME_TYPE\n    );\n    this.keyboard_manager.register_events(toinsert);\n    // Render to node\n    var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n    render(props, toinsert[0]);\n    element.append(toinsert);\n    return toinsert\n  }\n\n  events.on('output_added.OutputArea', handle_add_output);\n  events.on('output_updated.OutputArea', handle_update_output);\n  events.on('clear_output.CodeCell', handle_clear_output);\n  events.on('delete.Cell', handle_clear_output);\n  events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n  OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n    safe: true,\n    index: 0\n  });\n}\n\nif (window.Jupyter !== undefined) {\n  try {\n    var events = require('base/js/events');\n    var OutputArea = require('notebook/js/outputarea').OutputArea;\n    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n      register_renderer(events, OutputArea);\n    }\n  } catch(err) {\n  }\n}\n","application/javascript":["\n","if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n","  window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n","}\n","\n","\n","    function JupyterCommManager() {\n","    }\n","\n","    JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n","      if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n","        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n","        comm_manager.register_target(comm_id, function(comm) {\n","          comm.on_msg(msg_handler);\n","        });\n","      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n","        window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n","          comm.onMsg = msg_handler;\n","        });\n","      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n","        google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n","          var messages = comm.messages[Symbol.asyncIterator]();\n","          function processIteratorResult(result) {\n","            var message = result.value;\n","            console.log(message)\n","            var content = {data: message.data, comm_id};\n","            var buffers = []\n","            for (var buffer of message.buffers || []) {\n","              buffers.push(new DataView(buffer))\n","            }\n","            var metadata = message.metadata || {};\n","            var msg = {content, buffers, metadata}\n","            msg_handler(msg);\n","            return messages.next().then(processIteratorResult);\n","          }\n","          return messages.next().then(processIteratorResult);\n","        })\n","      }\n","    }\n","\n","    JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n","      if (comm_id in window.PyViz.comms) {\n","        return window.PyViz.comms[comm_id];\n","      } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n","        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n","        var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n","        if (msg_handler) {\n","          comm.on_msg(msg_handler);\n","        }\n","      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n","        var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n","        comm.open();\n","        if (msg_handler) {\n","          comm.onMsg = msg_handler;\n","        }\n","      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n","        var comm_promise = google.colab.kernel.comms.open(comm_id)\n","        comm_promise.then((comm) => {\n","          window.PyViz.comms[comm_id] = comm;\n","          if (msg_handler) {\n","            var messages = comm.messages[Symbol.asyncIterator]();\n","            function processIteratorResult(result) {\n","              var message = result.value;\n","              var content = {data: message.data};\n","              var metadata = message.metadata || {comm_id};\n","              var msg = {content, metadata}\n","              msg_handler(msg);\n","              return messages.next().then(processIteratorResult);\n","            }\n","            return messages.next().then(processIteratorResult);\n","          }\n","        }) \n","        var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n","          return comm_promise.then((comm) => {\n","            comm.send(data, metadata, buffers, disposeOnDone);\n","          });\n","        };\n","        var comm = {\n","          send: sendClosure\n","        };\n","      }\n","      window.PyViz.comms[comm_id] = comm;\n","      return comm;\n","    }\n","    window.PyViz.comm_manager = new JupyterCommManager();\n","    \n","\n","\n","var JS_MIME_TYPE = 'application/javascript';\n","var HTML_MIME_TYPE = 'text/html';\n","var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n","var CLASS_NAME = 'output';\n","\n","/**\n"," * Render data to the DOM node\n"," */\n","function render(props, node) {\n","  var div = document.createElement(\"div\");\n","  var script = document.createElement(\"script\");\n","  node.appendChild(div);\n","  node.appendChild(script);\n","}\n","\n","/**\n"," * Handle when a new output is added\n"," */\n","function handle_add_output(event, handle) {\n","  var output_area = handle.output_area;\n","  var output = handle.output;\n","  if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n","    return\n","  }\n","  var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n","  var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n","  if (id !== undefined) {\n","    var nchildren = toinsert.length;\n","    var html_node = toinsert[nchildren-1].children[0];\n","    html_node.innerHTML = output.data[HTML_MIME_TYPE];\n","    var scripts = [];\n","    var nodelist = html_node.querySelectorAll(\"script\");\n","    for (var i in nodelist) {\n","      if (nodelist.hasOwnProperty(i)) {\n","        scripts.push(nodelist[i])\n","      }\n","    }\n","\n","    scripts.forEach( function (oldScript) {\n","      var newScript = document.createElement(\"script\");\n","      var attrs = [];\n","      var nodemap = oldScript.attributes;\n","      for (var j in nodemap) {\n","        if (nodemap.hasOwnProperty(j)) {\n","          attrs.push(nodemap[j])\n","        }\n","      }\n","      attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n","      newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n","      oldScript.parentNode.replaceChild(newScript, oldScript);\n","    });\n","    if (JS_MIME_TYPE in output.data) {\n","      toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n","    }\n","    output_area._hv_plot_id = id;\n","    if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n","      window.PyViz.plot_index[id] = Bokeh.index[id];\n","    } else {\n","      window.PyViz.plot_index[id] = null;\n","    }\n","  } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n","    var bk_div = document.createElement(\"div\");\n","    bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n","    var script_attrs = bk_div.children[0].attributes;\n","    for (var i = 0; i < script_attrs.length; i++) {\n","      toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n","    }\n","    // store reference to server id on output_area\n","    output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n","  }\n","}\n","\n","/**\n"," * Handle when an output is cleared or removed\n"," */\n","function handle_clear_output(event, handle) {\n","  var id = handle.cell.output_area._hv_plot_id;\n","  var server_id = handle.cell.output_area._bokeh_server_id;\n","  if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n","  var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n","  if (server_id !== null) {\n","    comm.send({event_type: 'server_delete', 'id': server_id});\n","    return;\n","  } else if (comm !== null) {\n","    comm.send({event_type: 'delete', 'id': id});\n","  }\n","  delete PyViz.plot_index[id];\n","  if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n","    var doc = window.Bokeh.index[id].model.document\n","    doc.clear();\n","    const i = window.Bokeh.documents.indexOf(doc);\n","    if (i > -1) {\n","      window.Bokeh.documents.splice(i, 1);\n","    }\n","  }\n","}\n","\n","/**\n"," * Handle kernel restart event\n"," */\n","function handle_kernel_cleanup(event, handle) {\n","  delete PyViz.comms[\"hv-extension-comm\"];\n","  window.PyViz.plot_index = {}\n","}\n","\n","/**\n"," * Handle update_display_data messages\n"," */\n","function handle_update_output(event, handle) {\n","  handle_clear_output(event, {cell: {output_area: handle.output_area}})\n","  handle_add_output(event, handle)\n","}\n","\n","function register_renderer(events, OutputArea) {\n","  function append_mime(data, metadata, element) {\n","    // create a DOM node to render to\n","    var toinsert = this.create_output_subarea(\n","    metadata,\n","    CLASS_NAME,\n","    EXEC_MIME_TYPE\n","    );\n","    this.keyboard_manager.register_events(toinsert);\n","    // Render to node\n","    var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n","    render(props, toinsert[0]);\n","    element.append(toinsert);\n","    return toinsert\n","  }\n","\n","  events.on('output_added.OutputArea', handle_add_output);\n","  events.on('output_updated.OutputArea', handle_update_output);\n","  events.on('clear_output.CodeCell', handle_clear_output);\n","  events.on('delete.Cell', handle_clear_output);\n","  events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n","\n","  OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n","    safe: true,\n","    index: 0\n","  });\n","}\n","\n","if (window.Jupyter !== undefined) {\n","  try {\n","    var events = require('base/js/events');\n","    var OutputArea = require('notebook/js/outputarea').OutputArea;\n","    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n","      register_renderer(events, OutputArea);\n","    }\n","  } catch(err) {\n","  }\n","}\n"]},"metadata":{}},{"output_type":"display_data","data":{"text/html":["<style>.bk-root, .bk-root .bk:before, .bk-root .bk:after {\n","  font-family: var(--jp-ui-font-size1);\n","  font-size: var(--jp-ui-font-size1);\n","  color: var(--jp-ui-font-color1);\n","}\n","</style>"]},"metadata":{}}],"source":["pn.extension('texteditor', template=\"bootstrap\", sizing_mode='stretch_width')\n","pn.state.template.param.update(\n","    main_max_width=\"690px\",\n","    header_background=\"#F08080\",\n",")"]},{"cell_type":"code","execution_count":12,"id":"763db4d0-3436-41d3-8b0f-e66ce16468cd","metadata":{"tags":[],"id":"763db4d0-3436-41d3-8b0f-e66ce16468cd","executionInfo":{"status":"ok","timestamp":1683001185235,"user_tz":240,"elapsed":138,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["file_input = pn.widgets.FileInput(width=300)\n","\n","openaikey = pn.widgets.PasswordInput(\n","    value=\"\", placeholder=\"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\", width=300\n",")\n","prompt = pn.widgets.TextEditor(\n","    value=\"\", placeholder=\"Enter your questions here...\", height=160, toolbar=False\n",")\n","run_button = pn.widgets.Button(name=\"Run!\")\n","\n","select_k = pn.widgets.IntSlider(\n","    name=\"Number of relevant chunks\", start=1, end=5, step=1, value=2\n",")\n","select_chain_type = pn.widgets.RadioButtonGroup(\n","    name='Chain type', \n","    options=['stuff', 'map_reduce', \"refine\", \"map_rerank\"]\n",")\n","\n","widgets = pn.Row(\n","    pn.Column(prompt, run_button, margin=5),\n","    pn.Card(\n","        \"Chain type:\",\n","        pn.Column(select_chain_type, select_k),\n","        title=\"Advanced settings\", margin=10\n","    ), width=600\n",")"]},{"cell_type":"code","execution_count":13,"id":"9b83cc06-3401-498f-8f84-8a98370f3121","metadata":{"tags":[],"id":"9b83cc06-3401-498f-8f84-8a98370f3121","executionInfo":{"status":"ok","timestamp":1683001185238,"user_tz":240,"elapsed":139,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["def qa(file, query, chain_type, k):\n","    # load document\n","    loader = PyPDFLoader(file)\n","    documents = loader.load()\n","    # split the documents into chunks\n","    text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n","    texts = text_splitter.split_documents(documents)\n","    # select which embeddings we want to use\n","    embeddings = OpenAIEmbeddings()\n","    # create the vectorestore to use as the index\n","    db = Chroma.from_documents(texts, embeddings)\n","    # expose this index in a retriever interface\n","    retriever = db.as_retriever(search_type=\"similarity\", search_kwargs={\"k\": k})\n","    # create a chain to answer questions \n","    qa = RetrievalQA.from_chain_type(\n","        llm=OpenAI(), chain_type=chain_type, retriever=retriever, return_source_documents=True)\n","    result = qa({\"query\": query})\n","    print(result['result'])\n","    return result"]},{"cell_type":"code","execution_count":14,"id":"2722f43b-daf6-4d17-a842-41203ae9b140","metadata":{"tags":[],"id":"2722f43b-daf6-4d17-a842-41203ae9b140","executionInfo":{"status":"ok","timestamp":1683001185240,"user_tz":240,"elapsed":140,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["# result = qa(\"example.pdf\", \"what is the total number of AI publications?\")"]},{"cell_type":"code","execution_count":15,"id":"60e1b3d3-c0d2-4260-ae0c-26b03f1b8824","metadata":{"id":"60e1b3d3-c0d2-4260-ae0c-26b03f1b8824","executionInfo":{"status":"ok","timestamp":1683001185242,"user_tz":240,"elapsed":141,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["convos = []  # store all panel objects in a list\n","\n","def qa_result(_):\n","    os.environ[\"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\"] = openaikey.value\n","    \n","    # save pdf file to a temp file \n","    if file_input.value is not None:\n","        file_input.save(\"/.cache/temp.pdf\")\n","    \n","        prompt_text = prompt.value\n","        if prompt_text:\n","            result = qa(file=\"/.cache/temp.pdf\", query=prompt_text, chain_type=select_chain_type.value, k=select_k.value)\n","            convos.extend([\n","                pn.Row(\n","                    pn.panel(\"\\U0001F60A\", width=10),\n","                    prompt_text,\n","                    width=600\n","                ),\n","                pn.Row(\n","                    pn.panel(\"\\U0001F916\", width=10),\n","                    pn.Column(\n","                        result[\"result\"],\n","                        \"Relevant source text:\",\n","                        pn.pane.Markdown('\\n--------------------------------------------------------------------\\n'.join(doc.page_content for doc in result[\"source_documents\"]))\n","                    )\n","                )\n","            ])\n","            #return convos\n","    return pn.Column(*convos, margin=15, width=575, min_height=400)\n"]},{"cell_type":"code","execution_count":16,"id":"c3a70857-0b98-4f62-a9c0-b62ca42b474c","metadata":{"tags":[],"id":"c3a70857-0b98-4f62-a9c0-b62ca42b474c","executionInfo":{"status":"ok","timestamp":1683001185244,"user_tz":240,"elapsed":141,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["qa_interactive = pn.panel(\n","    pn.bind(qa_result, run_button),\n","    loading_indicator=True,\n",")"]},{"cell_type":"code","execution_count":17,"id":"228e2b42-b1ed-43af-b923-031a70241ab0","metadata":{"tags":[],"id":"228e2b42-b1ed-43af-b923-031a70241ab0","executionInfo":{"status":"ok","timestamp":1683001185246,"user_tz":240,"elapsed":142,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}}},"outputs":[],"source":["output = pn.WidgetBox('*Output will show up here:*', qa_interactive, width=630, scroll=True)"]},{"cell_type":"code","execution_count":19,"id":"1b0ec253-2bcd-4f91-96d8-d8456e900a58","metadata":{"tags":[],"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"1b0ec253-2bcd-4f91-96d8-d8456e900a58","executionInfo":{"status":"ok","timestamp":1683001252064,"user_tz":240,"elapsed":295,"user":{"displayName":"Mohammad Nasim","userId":"02163494460825715285"}},"outputId":"ab37a1d6-72ee-4c2e-a142-526e7ff5ad3e"},"outputs":[{"output_type":"display_data","data":{"application/javascript":["(function(root) {\n","  function now() {\n","    return new Date();\n","  }\n","\n","  var force = true;\n","\n","  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n","    root._bokeh_onload_callbacks = [];\n","    root._bokeh_is_loading = undefined;\n","  }\n","\n","  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n","    root._bokeh_timeout = Date.now() + 5000;\n","    root._bokeh_failed_load = false;\n","  }\n","\n","  function run_callbacks() {\n","    try {\n","      root._bokeh_onload_callbacks.forEach(function(callback) {\n","        if (callback != null)\n","          callback();\n","      });\n","    } finally {\n","      delete root._bokeh_onload_callbacks\n","    }\n","    console.debug(\"Bokeh: all callbacks have finished\");\n","  }\n","\n","  function load_libs(css_urls, js_urls, js_modules, callback) {\n","    if (css_urls == null) css_urls = [];\n","    if (js_urls == null) js_urls = [];\n","    if (js_modules == null) js_modules = [];\n","\n","    root._bokeh_onload_callbacks.push(callback);\n","    if (root._bokeh_is_loading > 0) {\n","      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n","      return null;\n","    }\n","    if (js_urls.length === 0 && js_modules.length === 0) {\n","      run_callbacks();\n","      return null;\n","    }\n","    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n","\n","    function on_load() {\n","      root._bokeh_is_loading--;\n","      if (root._bokeh_is_loading === 0) {\n","        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n","        run_callbacks()\n","      }\n","    }\n","\n","    function on_error() {\n","      console.error(\"failed to load \" + url);\n","    }\n","\n","    for (var i = 0; i < css_urls.length; i++) {\n","      var url = css_urls[i];\n","      const element = document.createElement(\"link\");\n","      element.onload = on_load;\n","      element.onerror = on_error;\n","      element.rel = \"stylesheet\";\n","      element.type = \"text/css\";\n","      element.href = url;\n","      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n","      document.body.appendChild(element);\n","    }\n","\n","    var skip = [];\n","    if (window.requirejs) {\n","      window.requirejs.config({'packages': {}, 'paths': {'Quill': 'https://cdn.quilljs.com/1.3.6/quill', 'gridstack': 'https://cdn.jsdelivr.net/npm/gridstack@4.2.5/dist/gridstack-h5', 'notyf': 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min'}, 'shim': {'gridstack': {'exports': 'GridStack'}}});\n","      require([\"Quill\"], function(Quill) {\n","\twindow.Quill = Quill\n","\ton_load()\n","      })\n","      require([\"gridstack\"], function(GridStack) {\n","\twindow.GridStack = GridStack\n","\ton_load()\n","      })\n","      require([\"notyf\"], function() {\n","\ton_load()\n","      })\n","      root._bokeh_is_loading = css_urls.length + 3;\n","    } else {\n","      root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n","    }    if (((window['Quill'] !== undefined) && (!(window['Quill'] instanceof HTMLElement))) || window.requirejs) {\n","      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js'];\n","      for (var i = 0; i < urls.length; i++) {\n","        skip.push(urls[i])\n","      }\n","    }    if (((window['GridStack'] !== undefined) && (!(window['GridStack'] instanceof HTMLElement))) || window.requirejs) {\n","      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/gridstack/gridstack@4.2.5/dist/gridstack-h5.js'];\n","      for (var i = 0; i < urls.length; i++) {\n","        skip.push(urls[i])\n","      }\n","    }    if (((window['Notyf'] !== undefined) && (!(window['Notyf'] instanceof HTMLElement))) || window.requirejs) {\n","      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/notificationarea/notyf@3/notyf.min.js'];\n","      for (var i = 0; i < urls.length; i++) {\n","        skip.push(urls[i])\n","      }\n","    }    for (var i = 0; i < js_urls.length; i++) {\n","      var url = js_urls[i];\n","      if (skip.indexOf(url) >= 0) {\n","\tif (!window.requirejs) {\n","\t  on_load();\n","\t}\n","\tcontinue;\n","      }\n","      var element = document.createElement('script');\n","      element.onload = on_load;\n","      element.onerror = on_error;\n","      element.async = false;\n","      element.src = url;\n","      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n","      document.head.appendChild(element);\n","    }\n","    for (var i = 0; i < js_modules.length; i++) {\n","      var url = js_modules[i];\n","      if (skip.indexOf(url) >= 0) {\n","\tif (!window.requirejs) {\n","\t  on_load();\n","\t}\n","\tcontinue;\n","      }\n","      var element = document.createElement('script');\n","      element.onload = on_load;\n","      element.onerror = on_error;\n","      element.async = false;\n","      element.src = url;\n","      element.type = \"module\";\n","      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n","      document.head.appendChild(element);\n","    }\n","    if (!js_urls.length && !js_modules.length) {\n","      on_load()\n","    }\n","  };\n","\n","  function inject_raw_css(css) {\n","    const element = document.createElement(\"style\");\n","    element.appendChild(document.createTextNode(css));\n","    document.body.appendChild(element);\n","  }\n","\n","  var js_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\", \"https://unpkg.com/@holoviz/panel@0.14.4/dist/panel.min.js\"];\n","  var js_modules = [];\n","  var css_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.bubble.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.snow.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/card.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/loading.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/json.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/debugger.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/widgets.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/markdown.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/dataframe.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/alerts.css\"];\n","  var inline_js = [    function(Bokeh) {\n","      inject_raw_css(\"\\n    .bk.pn-loading.arc:before {\\n      background-image: url(\\\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXJnaW46IGF1dG87IGJhY2tncm91bmQ6IG5vbmU7IGRpc3BsYXk6IGJsb2NrOyBzaGFwZS1yZW5kZXJpbmc6IGF1dG87IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYzNjM2MzIiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij4gICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjFzIiB2YWx1ZXM9IjAgNTAgNTA7MzYwIDUwIDUwIiBrZXlUaW1lcz0iMDsxIj48L2FuaW1hdGVUcmFuc2Zvcm0+ICA8L2NpcmNsZT48L3N2Zz4=\\\");\\n      background-size: auto calc(min(50%, 400px));\\n    }\\n    \");\n","    },    function(Bokeh) {\n","      Bokeh.set_log_level(\"info\");\n","    },\n","function(Bokeh) {} // ensure no trailing comma for IE\n","  ];\n","\n","  function run_inline_js() {\n","    if ((root.Bokeh !== undefined) || (force === true)) {\n","      for (var i = 0; i < inline_js.length; i++) {\n","        inline_js[i].call(root, root.Bokeh);\n","      }} else if (Date.now() < root._bokeh_timeout) {\n","      setTimeout(run_inline_js, 100);\n","    } else if (!root._bokeh_failed_load) {\n","      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n","      root._bokeh_failed_load = true;\n","    }\n","  }\n","\n","  if (root._bokeh_is_loading === 0) {\n","    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n","    run_inline_js();\n","  } else {\n","    load_libs(css_urls, js_urls, js_modules, function() {\n","      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n","      run_inline_js();\n","    });\n","  }\n","}(window));"],"application/vnd.holoviews_load.v0+json":"(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, js_modules, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n    if (js_modules == null) js_modules = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls.length === 0 && js_modules.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    var skip = [];\n    if (window.requirejs) {\n      window.requirejs.config({'packages': {}, 'paths': {'Quill': 'https://cdn.quilljs.com/1.3.6/quill', 'gridstack': 'https://cdn.jsdelivr.net/npm/gridstack@4.2.5/dist/gridstack-h5', 'notyf': 'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min'}, 'shim': {'gridstack': {'exports': 'GridStack'}}});\n      require([\"Quill\"], function(Quill) {\n\twindow.Quill = Quill\n\ton_load()\n      })\n      require([\"gridstack\"], function(GridStack) {\n\twindow.GridStack = GridStack\n\ton_load()\n      })\n      require([\"notyf\"], function() {\n\ton_load()\n      })\n      root._bokeh_is_loading = css_urls.length + 3;\n    } else {\n      root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n    }    if (((window['Quill'] !== undefined) && (!(window['Quill'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    if (((window['GridStack'] !== undefined) && (!(window['GridStack'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/gridstack/gridstack@4.2.5/dist/gridstack-h5.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    if (((window['Notyf'] !== undefined) && (!(window['Notyf'] instanceof HTMLElement))) || window.requirejs) {\n      var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/notificationarea/notyf@3/notyf.min.js'];\n      for (var i = 0; i < urls.length; i++) {\n        skip.push(urls[i])\n      }\n    }    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      if (skip.indexOf(url) >= 0) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n    for (var i = 0; i < js_modules.length; i++) {\n      var url = js_modules[i];\n      if (skip.indexOf(url) >= 0) {\n\tif (!window.requirejs) {\n\t  on_load();\n\t}\n\tcontinue;\n      }\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      element.type = \"module\";\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n    if (!js_urls.length && !js_modules.length) {\n      on_load()\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  var js_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\", \"https://unpkg.com/@holoviz/panel@0.14.4/dist/panel.min.js\"];\n  var js_modules = [];\n  var css_urls = [\"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.bubble.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.snow.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/card.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/loading.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/json.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/debugger.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/widgets.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/markdown.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/dataframe.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/alerts.css\"];\n  var inline_js = [    function(Bokeh) {\n      inject_raw_css(\"\\n    .bk.pn-loading.arc:before {\\n      background-image: url(\\\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXJnaW46IGF1dG87IGJhY2tncm91bmQ6IG5vbmU7IGRpc3BsYXk6IGJsb2NrOyBzaGFwZS1yZW5kZXJpbmc6IGF1dG87IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYzNjM2MzIiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij4gICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjFzIiB2YWx1ZXM9IjAgNTAgNTA7MzYwIDUwIDUwIiBrZXlUaW1lcz0iMDsxIj48L2FuaW1hdGVUcmFuc2Zvcm0+ICA8L2NpcmNsZT48L3N2Zz4=\\\");\\n      background-size: auto calc(min(50%, 400px));\\n    }\\n    \");\n    },    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n  ];\n\n  function run_inline_js() {\n    if ((root.Bokeh !== undefined) || (force === true)) {\n      for (var i = 0; i < inline_js.length; i++) {\n        inline_js[i].call(root, root.Bokeh);\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    }\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, js_modules, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"},"metadata":{}},{"output_type":"display_data","data":{"application/vnd.holoviews_load.v0+json":"\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n  window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n    function JupyterCommManager() {\n    }\n\n    JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n      if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n        comm_manager.register_target(comm_id, function(comm) {\n          comm.on_msg(msg_handler);\n        });\n      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n        window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n          comm.onMsg = msg_handler;\n        });\n      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n        google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n          var messages = comm.messages[Symbol.asyncIterator]();\n          function processIteratorResult(result) {\n            var message = result.value;\n            console.log(message)\n            var content = {data: message.data, comm_id};\n            var buffers = []\n            for (var buffer of message.buffers || []) {\n              buffers.push(new DataView(buffer))\n            }\n            var metadata = message.metadata || {};\n            var msg = {content, buffers, metadata}\n            msg_handler(msg);\n            return messages.next().then(processIteratorResult);\n          }\n          return messages.next().then(processIteratorResult);\n        })\n      }\n    }\n\n    JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n      if (comm_id in window.PyViz.comms) {\n        return window.PyViz.comms[comm_id];\n      } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n        var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n        if (msg_handler) {\n          comm.on_msg(msg_handler);\n        }\n      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n        var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n        comm.open();\n        if (msg_handler) {\n          comm.onMsg = msg_handler;\n        }\n      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n        var comm_promise = google.colab.kernel.comms.open(comm_id)\n        comm_promise.then((comm) => {\n          window.PyViz.comms[comm_id] = comm;\n          if (msg_handler) {\n            var messages = comm.messages[Symbol.asyncIterator]();\n            function processIteratorResult(result) {\n              var message = result.value;\n              var content = {data: message.data};\n              var metadata = message.metadata || {comm_id};\n              var msg = {content, metadata}\n              msg_handler(msg);\n              return messages.next().then(processIteratorResult);\n            }\n            return messages.next().then(processIteratorResult);\n          }\n        }) \n        var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n          return comm_promise.then((comm) => {\n            comm.send(data, metadata, buffers, disposeOnDone);\n          });\n        };\n        var comm = {\n          send: sendClosure\n        };\n      }\n      window.PyViz.comms[comm_id] = comm;\n      return comm;\n    }\n    window.PyViz.comm_manager = new JupyterCommManager();\n    \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n  var div = document.createElement(\"div\");\n  var script = document.createElement(\"script\");\n  node.appendChild(div);\n  node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n  var output_area = handle.output_area;\n  var output = handle.output;\n  if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n    return\n  }\n  var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n  var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n  if (id !== undefined) {\n    var nchildren = toinsert.length;\n    var html_node = toinsert[nchildren-1].children[0];\n    html_node.innerHTML = output.data[HTML_MIME_TYPE];\n    var scripts = [];\n    var nodelist = html_node.querySelectorAll(\"script\");\n    for (var i in nodelist) {\n      if (nodelist.hasOwnProperty(i)) {\n        scripts.push(nodelist[i])\n      }\n    }\n\n    scripts.forEach( function (oldScript) {\n      var newScript = document.createElement(\"script\");\n      var attrs = [];\n      var nodemap = oldScript.attributes;\n      for (var j in nodemap) {\n        if (nodemap.hasOwnProperty(j)) {\n          attrs.push(nodemap[j])\n        }\n      }\n      attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n      newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n      oldScript.parentNode.replaceChild(newScript, oldScript);\n    });\n    if (JS_MIME_TYPE in output.data) {\n      toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n    }\n    output_area._hv_plot_id = id;\n    if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n      window.PyViz.plot_index[id] = Bokeh.index[id];\n    } else {\n      window.PyViz.plot_index[id] = null;\n    }\n  } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n    var bk_div = document.createElement(\"div\");\n    bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n    var script_attrs = bk_div.children[0].attributes;\n    for (var i = 0; i < script_attrs.length; i++) {\n      toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n    }\n    // store reference to server id on output_area\n    output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n  }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n  var id = handle.cell.output_area._hv_plot_id;\n  var server_id = handle.cell.output_area._bokeh_server_id;\n  if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n  var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n  if (server_id !== null) {\n    comm.send({event_type: 'server_delete', 'id': server_id});\n    return;\n  } else if (comm !== null) {\n    comm.send({event_type: 'delete', 'id': id});\n  }\n  delete PyViz.plot_index[id];\n  if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n    var doc = window.Bokeh.index[id].model.document\n    doc.clear();\n    const i = window.Bokeh.documents.indexOf(doc);\n    if (i > -1) {\n      window.Bokeh.documents.splice(i, 1);\n    }\n  }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n  delete PyViz.comms[\"hv-extension-comm\"];\n  window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n  handle_clear_output(event, {cell: {output_area: handle.output_area}})\n  handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n  function append_mime(data, metadata, element) {\n    // create a DOM node to render to\n    var toinsert = this.create_output_subarea(\n    metadata,\n    CLASS_NAME,\n    EXEC_MIME_TYPE\n    );\n    this.keyboard_manager.register_events(toinsert);\n    // Render to node\n    var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n    render(props, toinsert[0]);\n    element.append(toinsert);\n    return toinsert\n  }\n\n  events.on('output_added.OutputArea', handle_add_output);\n  events.on('output_updated.OutputArea', handle_update_output);\n  events.on('clear_output.CodeCell', handle_clear_output);\n  events.on('delete.Cell', handle_clear_output);\n  events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n  OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n    safe: true,\n    index: 0\n  });\n}\n\nif (window.Jupyter !== undefined) {\n  try {\n    var events = require('base/js/events');\n    var OutputArea = require('notebook/js/outputarea').OutputArea;\n    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n      register_renderer(events, OutputArea);\n    }\n  } catch(err) {\n  }\n}\n","application/javascript":["\n","if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n","  window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n","}\n","\n","\n","    function JupyterCommManager() {\n","    }\n","\n","    JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n","      if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n","        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n","        comm_manager.register_target(comm_id, function(comm) {\n","          comm.on_msg(msg_handler);\n","        });\n","      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n","        window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n","          comm.onMsg = msg_handler;\n","        });\n","      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n","        google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n","          var messages = comm.messages[Symbol.asyncIterator]();\n","          function processIteratorResult(result) {\n","            var message = result.value;\n","            console.log(message)\n","            var content = {data: message.data, comm_id};\n","            var buffers = []\n","            for (var buffer of message.buffers || []) {\n","              buffers.push(new DataView(buffer))\n","            }\n","            var metadata = message.metadata || {};\n","            var msg = {content, buffers, metadata}\n","            msg_handler(msg);\n","            return messages.next().then(processIteratorResult);\n","          }\n","          return messages.next().then(processIteratorResult);\n","        })\n","      }\n","    }\n","\n","    JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n","      if (comm_id in window.PyViz.comms) {\n","        return window.PyViz.comms[comm_id];\n","      } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n","        var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n","        var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n","        if (msg_handler) {\n","          comm.on_msg(msg_handler);\n","        }\n","      } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n","        var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n","        comm.open();\n","        if (msg_handler) {\n","          comm.onMsg = msg_handler;\n","        }\n","      } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n","        var comm_promise = google.colab.kernel.comms.open(comm_id)\n","        comm_promise.then((comm) => {\n","          window.PyViz.comms[comm_id] = comm;\n","          if (msg_handler) {\n","            var messages = comm.messages[Symbol.asyncIterator]();\n","            function processIteratorResult(result) {\n","              var message = result.value;\n","              var content = {data: message.data};\n","              var metadata = message.metadata || {comm_id};\n","              var msg = {content, metadata}\n","              msg_handler(msg);\n","              return messages.next().then(processIteratorResult);\n","            }\n","            return messages.next().then(processIteratorResult);\n","          }\n","        }) \n","        var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n","          return comm_promise.then((comm) => {\n","            comm.send(data, metadata, buffers, disposeOnDone);\n","          });\n","        };\n","        var comm = {\n","          send: sendClosure\n","        };\n","      }\n","      window.PyViz.comms[comm_id] = comm;\n","      return comm;\n","    }\n","    window.PyViz.comm_manager = new JupyterCommManager();\n","    \n","\n","\n","var JS_MIME_TYPE = 'application/javascript';\n","var HTML_MIME_TYPE = 'text/html';\n","var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n","var CLASS_NAME = 'output';\n","\n","/**\n"," * Render data to the DOM node\n"," */\n","function render(props, node) {\n","  var div = document.createElement(\"div\");\n","  var script = document.createElement(\"script\");\n","  node.appendChild(div);\n","  node.appendChild(script);\n","}\n","\n","/**\n"," * Handle when a new output is added\n"," */\n","function handle_add_output(event, handle) {\n","  var output_area = handle.output_area;\n","  var output = handle.output;\n","  if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n","    return\n","  }\n","  var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n","  var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n","  if (id !== undefined) {\n","    var nchildren = toinsert.length;\n","    var html_node = toinsert[nchildren-1].children[0];\n","    html_node.innerHTML = output.data[HTML_MIME_TYPE];\n","    var scripts = [];\n","    var nodelist = html_node.querySelectorAll(\"script\");\n","    for (var i in nodelist) {\n","      if (nodelist.hasOwnProperty(i)) {\n","        scripts.push(nodelist[i])\n","      }\n","    }\n","\n","    scripts.forEach( function (oldScript) {\n","      var newScript = document.createElement(\"script\");\n","      var attrs = [];\n","      var nodemap = oldScript.attributes;\n","      for (var j in nodemap) {\n","        if (nodemap.hasOwnProperty(j)) {\n","          attrs.push(nodemap[j])\n","        }\n","      }\n","      attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n","      newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n","      oldScript.parentNode.replaceChild(newScript, oldScript);\n","    });\n","    if (JS_MIME_TYPE in output.data) {\n","      toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n","    }\n","    output_area._hv_plot_id = id;\n","    if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n","      window.PyViz.plot_index[id] = Bokeh.index[id];\n","    } else {\n","      window.PyViz.plot_index[id] = null;\n","    }\n","  } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n","    var bk_div = document.createElement(\"div\");\n","    bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n","    var script_attrs = bk_div.children[0].attributes;\n","    for (var i = 0; i < script_attrs.length; i++) {\n","      toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n","    }\n","    // store reference to server id on output_area\n","    output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n","  }\n","}\n","\n","/**\n"," * Handle when an output is cleared or removed\n"," */\n","function handle_clear_output(event, handle) {\n","  var id = handle.cell.output_area._hv_plot_id;\n","  var server_id = handle.cell.output_area._bokeh_server_id;\n","  if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n","  var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n","  if (server_id !== null) {\n","    comm.send({event_type: 'server_delete', 'id': server_id});\n","    return;\n","  } else if (comm !== null) {\n","    comm.send({event_type: 'delete', 'id': id});\n","  }\n","  delete PyViz.plot_index[id];\n","  if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n","    var doc = window.Bokeh.index[id].model.document\n","    doc.clear();\n","    const i = window.Bokeh.documents.indexOf(doc);\n","    if (i > -1) {\n","      window.Bokeh.documents.splice(i, 1);\n","    }\n","  }\n","}\n","\n","/**\n"," * Handle kernel restart event\n"," */\n","function handle_kernel_cleanup(event, handle) {\n","  delete PyViz.comms[\"hv-extension-comm\"];\n","  window.PyViz.plot_index = {}\n","}\n","\n","/**\n"," * Handle update_display_data messages\n"," */\n","function handle_update_output(event, handle) {\n","  handle_clear_output(event, {cell: {output_area: handle.output_area}})\n","  handle_add_output(event, handle)\n","}\n","\n","function register_renderer(events, OutputArea) {\n","  function append_mime(data, metadata, element) {\n","    // create a DOM node to render to\n","    var toinsert = this.create_output_subarea(\n","    metadata,\n","    CLASS_NAME,\n","    EXEC_MIME_TYPE\n","    );\n","    this.keyboard_manager.register_events(toinsert);\n","    // Render to node\n","    var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n","    render(props, toinsert[0]);\n","    element.append(toinsert);\n","    return toinsert\n","  }\n","\n","  events.on('output_added.OutputArea', handle_add_output);\n","  events.on('output_updated.OutputArea', handle_update_output);\n","  events.on('clear_output.CodeCell', handle_clear_output);\n","  events.on('delete.Cell', handle_clear_output);\n","  events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n","\n","  OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n","    safe: true,\n","    index: 0\n","  });\n","}\n","\n","if (window.Jupyter !== undefined) {\n","  try {\n","    var events = require('base/js/events');\n","    var OutputArea = require('notebook/js/outputarea').OutputArea;\n","    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n","      register_renderer(events, OutputArea);\n","    }\n","  } catch(err) {\n","  }\n","}\n"]},"metadata":{}},{"output_type":"display_data","data":{"text/html":["<style>.bk-root, .bk-root .bk:before, .bk-root .bk:after {\n","  font-family: var(--jp-ui-font-size1);\n","  font-size: var(--jp-ui-font-size1);\n","  color: var(--jp-ui-font-color1);\n","}\n","</style>"]},"metadata":{}},{"output_type":"display_data","data":{"text/html":["\n","<pre>Traceback (most recent call last):\n","  File &quot;/usr/local/lib/python3.10/dist-packages/pyviz_comms/__init__.py&quot;, line 346, in _handle_msg\n","    self._on_msg(msg)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/viewable.py&quot;, line 297, in _on_msg\n","    patch.apply_to_document(doc, comm.id if comm else None)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/protocol/messages/patch_doc.py&quot;, line 115, in apply_to_document\n","    invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter))\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/callbacks.py&quot;, line 408, in invoke_with_curdoc\n","    return f()\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/protocol/messages/patch_doc.py&quot;, line 115, in &lt;lambda&gt;\n","    invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter))\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/document.py&quot;, line 391, in apply_json_patch\n","    DocumentPatchedEvent.handle_json(self, event_json, references, setter)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/events.py&quot;, line 259, in handle_json\n","    handler(doc, event_json, references, setter)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/events.py&quot;, line 300, in _handle_json\n","    cb(event_json[&quot;msg_data&quot;])\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/callbacks.py&quot;, line 355, in trigger_json_event\n","    model._trigger_event(event)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/util/callback_manager.py&quot;, line 119, in _trigger_event\n","    self.document.callbacks.notify_event(cast(Model, self), event, invoke)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/callbacks.py&quot;, line 247, in notify_event\n","    invoke_with_curdoc(doc, callback_invoker)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/document/callbacks.py&quot;, line 408, in invoke_with_curdoc\n","    return f()\n","  File &quot;/usr/local/lib/python3.10/dist-packages/bokeh/util/callback_manager.py&quot;, line 115, in invoke\n","    cast(EventCallbackWithEvent, callback)(event)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/reactive.py&quot;, line 413, in _comm_event\n","    state._handle_exception(e)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/io/state.py&quot;, line 408, in _handle_exception\n","    raise exception\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/reactive.py&quot;, line 411, in _comm_event\n","    self._process_bokeh_event(doc, event)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/reactive.py&quot;, line 348, in _process_bokeh_event\n","    self._process_event(event)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/widgets/button.py&quot;, line 183, in _process_event\n","    self.param.trigger(&#x27;value&#x27;)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/param/parameterized.py&quot;, line 1993, in trigger\n","    self_.set_param(**dict(params, **triggers))\n","  File &quot;/usr/local/lib/python3.10/dist-packages/param/parameterized.py&quot;, line 1929, in set_param\n","    return self_.update(kwargs)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/param/parameterized.py&quot;, line 1902, in update\n","    self_._batch_call_watchers()\n","  File &quot;/usr/local/lib/python3.10/dist-packages/param/parameterized.py&quot;, line 2063, in _batch_call_watchers\n","    self_._execute_watcher(watcher, events)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/param/parameterized.py&quot;, line 2025, in _execute_watcher\n","    watcher.fn(*args, **kwargs)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/param.py&quot;, line 838, in _replace_pane\n","    new_object = self.eval(self.object)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/param.py&quot;, line 818, in eval\n","    return function(*args, **kwargs)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/param/parameterized.py&quot;, line 407, in _depends\n","    return func(*args, **kw)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/depends.py&quot;, line 209, in wrapped\n","    return function(*combined_args, **combined_kwargs)\n","  File &quot;&lt;ipython-input-15-e2b58ab37770&gt;&quot;, line 8, in qa_result\n","    file_input.save(&quot;/.cache/temp.pdf&quot;)\n","  File &quot;/usr/local/lib/python3.10/dist-packages/panel/widgets/input.py&quot;, line 214, in save\n","    with open(fn, &#x27;wb&#x27;) as f:\n","FileNotFoundError: [Errno 2] No such file or directory: &#x27;/.cache/temp.pdf&#x27;\n","</pre>\n"]},"metadata":{}},{"output_type":"execute_result","data":{"text/html":["<div id='1051'>\n","  <div class=\"bk-root\" id=\"e6dfbfba-cd99-46ad-ab43-ffc33c4172b8\" data-root-id=\"1051\"></div>\n","</div>\n","<script type=\"application/javascript\">(function(root) {\n","  function embed_document(root) {\n","    var docs_json = {\"85edc8ad-1892-4dfc-9b9a-630a11405561\":{\"defs\":[{\"extends\":null,\"module\":null,\"name\":\"ReactiveHTML1\",\"overrides\":[],\"properties\":[]},{\"extends\":null,\"module\":null,\"name\":\"FlexBox1\",\"overrides\":[],\"properties\":[{\"default\":\"flex-start\",\"kind\":null,\"name\":\"align_content\"},{\"default\":\"flex-start\",\"kind\":null,\"name\":\"align_items\"},{\"default\":\"row\",\"kind\":null,\"name\":\"flex_direction\"},{\"default\":\"wrap\",\"kind\":null,\"name\":\"flex_wrap\"},{\"default\":\"flex-start\",\"kind\":null,\"name\":\"justify_content\"}]},{\"extends\":null,\"module\":null,\"name\":\"GridStack1\",\"overrides\":[],\"properties\":[{\"default\":\"warn\",\"kind\":null,\"name\":\"mode\"},{\"default\":null,\"kind\":null,\"name\":\"ncols\"},{\"default\":null,\"kind\":null,\"name\":\"nrows\"},{\"default\":true,\"kind\":null,\"name\":\"allow_resize\"},{\"default\":true,\"kind\":null,\"name\":\"allow_drag\"},{\"default\":[],\"kind\":null,\"name\":\"state\"}]},{\"extends\":null,\"module\":null,\"name\":\"click1\",\"overrides\":[],\"properties\":[{\"default\":\"\",\"kind\":null,\"name\":\"terminal_output\"},{\"default\":\"\",\"kind\":null,\"name\":\"debug_name\"},{\"default\":0,\"kind\":null,\"name\":\"clears\"}]},{\"extends\":null,\"module\":null,\"name\":\"NotificationAreaBase1\",\"overrides\":[],\"properties\":[{\"default\":\"bottom-right\",\"kind\":null,\"name\":\"position\"},{\"default\":0,\"kind\":null,\"name\":\"_clear\"}]},{\"extends\":null,\"module\":null,\"name\":\"NotificationArea1\",\"overrides\":[],\"properties\":[{\"default\":[],\"kind\":null,\"name\":\"notifications\"},{\"default\":\"bottom-right\",\"kind\":null,\"name\":\"position\"},{\"default\":0,\"kind\":null,\"name\":\"_clear\"},{\"default\":[{\"background\":\"#ffc107\",\"icon\":{\"className\":\"fas fa-exclamation-triangle\",\"color\":\"white\",\"tagName\":\"i\"},\"type\":\"warning\"},{\"background\":\"#007bff\",\"icon\":{\"className\":\"fas fa-info-circle\",\"color\":\"white\",\"tagName\":\"i\"},\"type\":\"info\"}],\"kind\":null,\"name\":\"types\"}]},{\"extends\":null,\"module\":null,\"name\":\"Notification\",\"overrides\":[],\"properties\":[{\"default\":null,\"kind\":null,\"name\":\"background\"},{\"default\":3000,\"kind\":null,\"name\":\"duration\"},{\"default\":null,\"kind\":null,\"name\":\"icon\"},{\"default\":\"\",\"kind\":null,\"name\":\"message\"},{\"default\":null,\"kind\":null,\"name\":\"notification_type\"},{\"default\":false,\"kind\":null,\"name\":\"_destroyed\"}]},{\"extends\":null,\"module\":null,\"name\":\"TemplateActions1\",\"overrides\":[],\"properties\":[{\"default\":0,\"kind\":null,\"name\":\"open_modal\"},{\"default\":0,\"kind\":null,\"name\":\"close_modal\"}]},{\"extends\":null,\"module\":null,\"name\":\"MaterialTemplateActions1\",\"overrides\":[],\"properties\":[{\"default\":0,\"kind\":null,\"name\":\"open_modal\"},{\"default\":0,\"kind\":null,\"name\":\"close_modal\"}]}],\"roots\":{\"references\":[{\"attributes\":{\"active\":0,\"labels\":[\"stuff\",\"map_reduce\",\"refine\",\"map_rerank\"],\"margin\":[5,10,5,10],\"sizing_mode\":\"stretch_width\"},\"id\":\"1069\",\"type\":\"RadioButtonGroup\"},{\"attributes\":{\"children\":[{\"id\":\"1061\"},{\"id\":\"1064\"}],\"margin\":[0,0,0,0],\"min_width\":600,\"name\":\"Row00169\",\"width\":600},\"id\":\"1060\",\"type\":\"Row\"},{\"attributes\":{\"client_comm_id\":\"8071b5428c9d478082b13f69811aae79\",\"comm_id\":\"958fa0b17d52427d88a115d2e5d06ba6\",\"plot_id\":\"1051\"},\"id\":\"1072\",\"type\":\"panel.models.comm_manager.CommManager\"},{\"attributes\":{\"children\":[{\"id\":\"1057\"},{\"id\":\"1058\"}],\"css_classes\":[\"panel-widget-box\",\"scrollable\"],\"margin\":[5,5,5,5],\"min_width\":630,\"name\":\"WidgetBox00180\",\"width\":630},\"id\":\"1056\",\"type\":\"Column\"},{\"attributes\":{\"css_classes\":[\"markdown\"],\"margin\":[5,5,5,5],\"name\":\"Markdown00187\",\"sizing_mode\":\"stretch_width\",\"text\":\"&lt;h2&gt;\\ud83d\\ude0a! Question Answering with your PDF file&lt;/h2&gt;\\n&lt;p&gt;1) Upload a PDF. 2) Enter OpenAI API key. This costs $. Set up billing at &lt;a href=&quot;https://platform.openai.com/account&quot;&gt;OpenAI&lt;/a&gt;. 3) Type a question and click &amp;ldquo;Run&amp;rdquo;.&lt;/p&gt;\"},\"id\":\"1052\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"children\":[{\"id\":\"1052\"},{\"id\":\"1053\"},{\"id\":\"1056\"},{\"id\":\"1060\"}],\"margin\":[0,0,0,0],\"name\":\"Column00190\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1051\",\"type\":\"Column\"},{\"attributes\":{\"margin\":[5,10,5,10],\"min_width\":300,\"width\":300},\"id\":\"1054\",\"type\":\"FileInput\"},{\"attributes\":{\"end\":5,\"margin\":[5,10,5,10],\"sizing_mode\":\"stretch_width\",\"start\":1,\"title\":\"Number of relevant chunks\",\"value\":2},\"id\":\"1070\",\"type\":\"Slider\"},{\"attributes\":{\"children\":[{\"id\":\"1062\"},{\"id\":\"1063\"}],\"margin\":[5,5,5,5],\"name\":\"Column00161\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1061\",\"type\":\"Column\"},{\"attributes\":{\"margin\":[5,10,5,10],\"max_length\":5000,\"min_width\":300,\"placeholder\":\"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\",\"width\":300},\"id\":\"1055\",\"type\":\"PasswordInput\"},{\"attributes\":{\"css_classes\":[\"card-title\"],\"margin\":[5,0,5,0],\"name\":\"HTML00167\",\"sizing_mode\":\"stretch_width\",\"text\":\"Advanced settings\"},\"id\":\"1066\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"children\":[{\"id\":\"1059\"}],\"margin\":[0,0,0,0],\"name\":\"Row00174\"},\"id\":\"1058\",\"type\":\"Row\"},{\"attributes\":{\"children\":[{\"id\":\"1054\"},{\"id\":\"1055\"}],\"margin\":[0,0,0,0],\"name\":\"Row00189\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1053\",\"type\":\"Row\"},{\"attributes\":{\"icon\":null,\"js_event_callbacks\":{\"button_click\":[{\"id\":\"1071\"}]},\"label\":\"Run!\",\"margin\":[5,10,5,10],\"sizing_mode\":\"stretch_width\",\"subscribed_events\":[\"button_click\"]},\"id\":\"1063\",\"type\":\"Button\"},{\"attributes\":{\"children\":[{\"id\":\"1066\"}],\"css_classes\":[\"card-header-row\"],\"margin\":[0,0,0,0],\"name\":\"Row00163\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1065\",\"type\":\"Row\"},{\"attributes\":{\"css_classes\":[\"markdown\"],\"margin\":[5,5,5,5],\"name\":\"Markdown00178\",\"sizing_mode\":\"stretch_width\",\"text\":\"&lt;p&gt;&lt;em&gt;Output will show up here:&lt;/em&gt;&lt;/p&gt;\"},\"id\":\"1057\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"children\":[{\"id\":\"1069\"},{\"id\":\"1070\"}],\"margin\":[0,0,0,0],\"name\":\"Column00162\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1068\",\"type\":\"Column\"},{\"attributes\":{\"active_header_background\":\"\",\"button_css_classes\":[\"card-button\"],\"children\":[{\"id\":\"1065\"},{\"id\":\"1067\"},{\"id\":\"1068\"}],\"collapsed\":false,\"css_classes\":[\"card\"],\"header_background\":\"\",\"header_color\":\"\",\"header_css_classes\":[\"card-header\"],\"margin\":[10,10,10,10],\"name\":\"Card00166\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1064\",\"type\":\"panel.models.layout.Card\"},{\"attributes\":{\"css_classes\":[\"markdown\"],\"margin\":[5,5,5,5],\"name\":\"Markdown00164\",\"sizing_mode\":\"stretch_width\",\"text\":\"&lt;p&gt;Chain type:&lt;/p&gt;\"},\"id\":\"1067\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"args\":{\"bidirectional\":false,\"properties\":{\"event:button_click\":\"loading\"},\"source\":{\"id\":\"1063\"},\"target\":{\"id\":\"1058\"}},\"code\":\"\\n    if ('event:button_click'.startsWith('event:')) {\\n      var value = true\\n    } else {\\n      var value = source['event:button_click'];\\n      value = value;\\n    }\\n    if (typeof value !== 'boolean' || source.labels !== ['Loading']) {\\n      value = true\\n    }\\n    var css_classes = target.css_classes.slice()\\n    var loading_css = ['pn-loading', 'arc']\\n    if (value) {\\n      for (var css of loading_css) {\\n        if (!(css in css_classes)) {\\n          css_classes.push(css)\\n        }\\n      }\\n    } else {\\n     for (var css of loading_css) {\\n        var index = css_classes.indexOf(css)\\n        if (index > -1) {\\n          css_classes.splice(index, 1)\\n        }\\n      }\\n    }\\n    target['css_classes'] = css_classes\\n    \",\"tags\":[[139828762366192,[null,\"event:button_click\"],[null,\"loading\"]]]},\"id\":\"1071\",\"type\":\"CustomJS\"},{\"attributes\":{\"height\":160,\"margin\":[5,10,5,10],\"name\":\"\",\"placeholder\":\"Enter your questions here...\",\"sizing_mode\":\"stretch_width\",\"text\":\"<p>Which resume is this?</p>\",\"toolbar\":false},\"id\":\"1062\",\"type\":\"panel.models.quill.QuillInput\"},{\"attributes\":{\"margin\":[15,15,15,15],\"min_height\":400,\"min_width\":575,\"name\":\"Column00176\",\"width\":575},\"id\":\"1059\",\"type\":\"Column\"}],\"root_ids\":[\"1051\",\"1072\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n","    var render_items = [{\"docid\":\"85edc8ad-1892-4dfc-9b9a-630a11405561\",\"root_ids\":[\"1051\"],\"roots\":{\"1051\":\"e6dfbfba-cd99-46ad-ab43-ffc33c4172b8\"}}];\n","    root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n","    for (const render_item of render_items) {\n","      for (const root_id of render_item.root_ids) {\n","\tconst id_el = document.getElementById(root_id)\n","\tif (id_el.children.length && (id_el.children[0].className === 'bk-root')) {\n","\t  const root_el = id_el.children[0]\n","\t  root_el.id = root_el.id + '-rendered'\n","\t}\n","      }\n","    }\n","  }\n","  if (root.Bokeh !== undefined && root.Bokeh.Panel !== undefined) {\n","    embed_document(root);\n","  } else {\n","    var attempts = 0;\n","    var timer = setInterval(function(root) {\n","      if (root.Bokeh !== undefined && root.Bokeh.Panel !== undefined) {\n","        clearInterval(timer);\n","        embed_document(root);\n","      } else if (document.readyState == \"complete\") {\n","        attempts++;\n","        if (attempts > 200) {\n","          clearInterval(timer);\n","          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n","        }\n","      }\n","    }, 25, root)\n","  }\n","})(window);</script>"],"application/vnd.holoviews_exec.v0+json":"","text/plain":["Column(sizing_mode='stretch_width')\n","    [0] Markdown(str, sizing_mode='stretch_width')\n","    [1] Row(sizing_mode='stretch_width')\n","        [0] FileInput(filename='Resume.pdf', mime_type='application/pdf', value=b'%PDF-1.4\\n%\\xaa\\xab\\xac\\..., width=300)\n","        [1] PasswordInput(placeholder='sk-3XDdQo1KIclSE2RiN5PeT3..., width=300)\n","    [2] WidgetBox(scroll=True, width=630)\n","        [0] Markdown(str, sizing_mode='stretch_width')\n","        [1] ParamFunction(function, _pane=Column, loading_indicator=True, sizing_mode='stretch_width')\n","    [3] Row(width=600)\n","        [0] Column(margin=5, sizing_mode='stretch_width')\n","            [0] TextEditor(height=160, placeholder='Enter your questions h..., sizing_mode='stretch_width', toolbar=False, value='<p>Which resume i...)\n","            [1] Button(name='Run!', sizing_mode='stretch_width', value=True)\n","        [1] Card(margin=10, sizing_mode='stretch_width', title='Advanced settings')\n","            [0] Markdown(str, sizing_mode='stretch_width')\n","            [1] Column(sizing_mode='stretch_width')\n","                [0] RadioButtonGroup(name='Chain type', options=['stuff', 'map_reduce', ...], sizing_mode='stretch_width', value='stuff')\n","                [1] IntSlider(end=5, name='Number of relevant c..., sizing_mode='stretch_width', start=1, value=2)"]},"metadata":{"application/vnd.holoviews_exec.v0+json":{"id":"1051"}},"execution_count":19}],"source":["# layout\n","pn.Column(\n","    pn.pane.Markdown(\"\"\"\n","    ## \\U0001F60A! Question Answering with your PDF file\n","    \n","    1) Upload a PDF. 2) Enter OpenAI API key. 3) Type a question and click \"Run\".\n","    \n","    \"\"\"),\n","    pn.Row(file_input,openaikey),\n","    output,\n","    widgets\n","\n",").servable()"]}],"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.10.10"},"colab":{"provenance":[]}},"nbformat":4,"nbformat_minor":5}