Spaces:
Runtime error
Runtime error
Upload 4 files
Browse filesdeploy to hugging face
- Dockerfile +16 -0
- GPT-4_PDF_summary.ipynb +915 -0
- requirements.txt +7 -0
Dockerfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10.10
|
| 2 |
+
|
| 3 |
+
WORKDIR /code
|
| 4 |
+
|
| 5 |
+
COPY ./requirements.txt /code/requirements.t×t
|
| 6 |
+
RUN python3 -m pip install --no-cache-dir --upgrade pip
|
| 7 |
+
RUN python3 -m pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
+
|
| 9 |
+
COPY . .
|
| 10 |
+
|
| 11 |
+
CMD ["panel", "serve", "/code/GPT-4_PDF_summary.ipynb", "--address", "0.0.0.0", "--port", "7860", "--allow-websocket-origin", "chomakov-GPT-4_PDF_summary.hf.space", "--allow-websocket-origin", "0.0.0.0:7860"]
|
| 12 |
+
|
| 13 |
+
RUN mkdir /.cache
|
| 14 |
+
RUN chmod 777 /.cache
|
| 15 |
+
RUN mkdir .chroma
|
| 16 |
+
RUN chmod 777 .chroma
|
GPT-4_PDF_summary.ipynb
ADDED
|
@@ -0,0 +1,915 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "409a312d",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"name": "stdout",
|
| 11 |
+
"output_type": "stream",
|
| 12 |
+
"text": [
|
| 13 |
+
"Requirement already satisfied: langchain in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.0.136)\n",
|
| 14 |
+
"Requirement already satisfied: openai in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.27.4)\n",
|
| 15 |
+
"Requirement already satisfied: chromadb in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.3.21)\n",
|
| 16 |
+
"Requirement already satisfied: tiktoken in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.3.3)\n",
|
| 17 |
+
"Requirement already satisfied: pypdf in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (3.7.1)\n",
|
| 18 |
+
"Requirement already satisfied: panel in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.14.4)\n",
|
| 19 |
+
"Requirement already satisfied: SQLAlchemy<2,>=1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (1.4.47)\n",
|
| 20 |
+
"Requirement already satisfied: pydantic<2,>=1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (1.10.7)\n",
|
| 21 |
+
"Requirement already satisfied: dataclasses-json<0.6.0,>=0.5.7 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (0.5.7)\n",
|
| 22 |
+
"Requirement already satisfied: PyYAML>=5.4.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (6.0)\n",
|
| 23 |
+
"Requirement already satisfied: numpy<2,>=1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (1.24.2)\n",
|
| 24 |
+
"Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (3.8.4)\n",
|
| 25 |
+
"Requirement already satisfied: openapi-schema-pydantic<2.0,>=1.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (1.2.4)\n",
|
| 26 |
+
"Requirement already satisfied: requests<3,>=2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (2.28.2)\n",
|
| 27 |
+
"Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (8.2.2)\n",
|
| 28 |
+
"Requirement already satisfied: async-timeout<5.0.0,>=4.0.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from langchain) (4.0.2)\n",
|
| 29 |
+
"Requirement already satisfied: tqdm in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from openai) (4.65.0)\n",
|
| 30 |
+
"Requirement already satisfied: uvicorn[standard]>=0.18.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (0.21.1)\n",
|
| 31 |
+
"Requirement already satisfied: pandas>=1.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (2.0.0)\n",
|
| 32 |
+
"Requirement already satisfied: hnswlib>=0.7 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (0.7.0)\n",
|
| 33 |
+
"Requirement already satisfied: fastapi>=0.85.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (0.95.0)\n",
|
| 34 |
+
"Requirement already satisfied: sentence-transformers>=2.2.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (2.2.2)\n",
|
| 35 |
+
"Requirement already satisfied: duckdb>=0.7.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (0.7.1)\n",
|
| 36 |
+
"Requirement already satisfied: posthog>=2.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (2.5.0)\n",
|
| 37 |
+
"Requirement already satisfied: clickhouse-connect>=0.5.7 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from chromadb) (0.5.20)\n",
|
| 38 |
+
"Requirement already satisfied: regex>=2022.1.18 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from tiktoken) (2023.3.23)\n",
|
| 39 |
+
"Requirement already satisfied: setuptools>=42 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (65.5.0)\n",
|
| 40 |
+
"Requirement already satisfied: pyviz-comms>=0.7.4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (2.2.1)\n",
|
| 41 |
+
"Requirement already satisfied: pyct>=0.4.4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (0.5.0)\n",
|
| 42 |
+
"Requirement already satisfied: bleach in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (6.0.0)\n",
|
| 43 |
+
"Requirement already satisfied: param>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (1.13.0)\n",
|
| 44 |
+
"Requirement already satisfied: typing-extensions in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (4.5.0)\n",
|
| 45 |
+
"Requirement already satisfied: bokeh<2.5.0,>=2.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (2.4.3)\n",
|
| 46 |
+
"Requirement already satisfied: markdown in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from panel) (3.4.3)\n",
|
| 47 |
+
"Requirement already satisfied: attrs>=17.3.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (22.2.0)\n",
|
| 48 |
+
"Requirement already satisfied: yarl<2.0,>=1.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.8.2)\n",
|
| 49 |
+
"Requirement already satisfied: multidict<7.0,>=4.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (6.0.4)\n",
|
| 50 |
+
"Requirement already satisfied: aiosignal>=1.1.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.1)\n",
|
| 51 |
+
"Requirement already satisfied: frozenlist>=1.1.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.3)\n",
|
| 52 |
+
"Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (3.1.0)\n",
|
| 53 |
+
"Requirement already satisfied: Jinja2>=2.9 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from bokeh<2.5.0,>=2.4.0->panel) (3.1.2)\n",
|
| 54 |
+
"Requirement already satisfied: tornado>=5.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from bokeh<2.5.0,>=2.4.0->panel) (6.2)\n",
|
| 55 |
+
"Requirement already satisfied: pillow>=7.1.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from bokeh<2.5.0,>=2.4.0->panel) (9.5.0)\n",
|
| 56 |
+
"Requirement already satisfied: packaging>=16.8 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from bokeh<2.5.0,>=2.4.0->panel) (23.0)\n",
|
| 57 |
+
"Requirement already satisfied: pytz in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from clickhouse-connect>=0.5.7->chromadb) (2023.3)\n",
|
| 58 |
+
"Requirement already satisfied: urllib3>=1.26 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from clickhouse-connect>=0.5.7->chromadb) (1.26.15)\n",
|
| 59 |
+
"Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from clickhouse-connect>=0.5.7->chromadb) (2022.12.7)\n",
|
| 60 |
+
"Requirement already satisfied: zstandard in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from clickhouse-connect>=0.5.7->chromadb) (0.20.0)\n",
|
| 61 |
+
"Requirement already satisfied: lz4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from clickhouse-connect>=0.5.7->chromadb) (4.3.2)\n",
|
| 62 |
+
"Requirement already satisfied: marshmallow<4.0.0,>=3.3.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (3.19.0)\n",
|
| 63 |
+
"Requirement already satisfied: typing-inspect>=0.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (0.8.0)\n",
|
| 64 |
+
"Requirement already satisfied: marshmallow-enum<2.0.0,>=1.5.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (1.5.1)\n",
|
| 65 |
+
"Requirement already satisfied: starlette<0.27.0,>=0.26.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fastapi>=0.85.1->chromadb) (0.26.1)\n"
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"name": "stdout",
|
| 70 |
+
"output_type": "stream",
|
| 71 |
+
"text": [
|
| 72 |
+
"Requirement already satisfied: python-dateutil>=2.8.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas>=1.3->chromadb) (2.8.2)\n",
|
| 73 |
+
"Requirement already satisfied: tzdata>=2022.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pandas>=1.3->chromadb) (2023.3)\n",
|
| 74 |
+
"Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from posthog>=2.4.0->chromadb) (1.16.0)\n",
|
| 75 |
+
"Requirement already satisfied: monotonic>=1.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from posthog>=2.4.0->chromadb) (1.6)\n",
|
| 76 |
+
"Requirement already satisfied: backoff>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from posthog>=2.4.0->chromadb) (2.2.1)\n",
|
| 77 |
+
"Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests<3,>=2->langchain) (3.4)\n",
|
| 78 |
+
"Requirement already satisfied: transformers<5.0.0,>=4.6.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (4.27.4)\n",
|
| 79 |
+
"Requirement already satisfied: torch>=1.6.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (2.0.0)\n",
|
| 80 |
+
"Requirement already satisfied: torchvision in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (0.15.1)\n",
|
| 81 |
+
"Requirement already satisfied: scikit-learn in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (1.2.2)\n",
|
| 82 |
+
"Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (1.10.1)\n",
|
| 83 |
+
"Requirement already satisfied: nltk in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (3.8.1)\n",
|
| 84 |
+
"Requirement already satisfied: sentencepiece in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (0.1.97)\n",
|
| 85 |
+
"Requirement already satisfied: huggingface-hub>=0.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sentence-transformers>=2.2.2->chromadb) (0.13.4)\n",
|
| 86 |
+
"Requirement already satisfied: click>=7.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (8.1.3)\n",
|
| 87 |
+
"Requirement already satisfied: h11>=0.8 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.14.0)\n",
|
| 88 |
+
"Requirement already satisfied: uvloop!=0.15.0,!=0.15.1,>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.17.0)\n",
|
| 89 |
+
"Requirement already satisfied: httptools>=0.5.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.5.0)\n",
|
| 90 |
+
"Requirement already satisfied: websockets>=10.4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (11.0.1)\n",
|
| 91 |
+
"Requirement already satisfied: python-dotenv>=0.13 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (1.0.0)\n",
|
| 92 |
+
"Requirement already satisfied: watchfiles>=0.13 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.19.0)\n",
|
| 93 |
+
"Requirement already satisfied: webencodings in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from bleach->panel) (0.5.1)\n",
|
| 94 |
+
"Requirement already satisfied: filelock in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from huggingface-hub>=0.4.0->sentence-transformers>=2.2.2->chromadb) (3.11.0)\n",
|
| 95 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from Jinja2>=2.9->bokeh<2.5.0,>=2.4.0->panel) (2.1.2)\n",
|
| 96 |
+
"Requirement already satisfied: anyio<5,>=3.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from starlette<0.27.0,>=0.26.1->fastapi>=0.85.1->chromadb) (3.6.2)\n",
|
| 97 |
+
"Requirement already satisfied: sympy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (1.11.1)\n",
|
| 98 |
+
"Requirement already satisfied: networkx in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (3.1)\n",
|
| 99 |
+
"Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from transformers<5.0.0,>=4.6.0->sentence-transformers>=2.2.2->chromadb) (0.13.3)\n",
|
| 100 |
+
"Requirement already satisfied: mypy-extensions>=0.3.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from typing-inspect>=0.4.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (1.0.0)\n",
|
| 101 |
+
"Requirement already satisfied: joblib in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from nltk->sentence-transformers>=2.2.2->chromadb) (1.2.0)\n",
|
| 102 |
+
"Requirement already satisfied: threadpoolctl>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from scikit-learn->sentence-transformers>=2.2.2->chromadb) (3.1.0)\n",
|
| 103 |
+
"Requirement already satisfied: sniffio>=1.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from anyio<5,>=3.4.0->starlette<0.27.0,>=0.26.1->fastapi>=0.85.1->chromadb) (1.3.0)\n",
|
| 104 |
+
"Requirement already satisfied: mpmath>=0.19 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from sympy->torch>=1.6.0->sentence-transformers>=2.2.2->chromadb) (1.3.0)\n"
|
| 105 |
+
]
|
| 106 |
+
}
|
| 107 |
+
],
|
| 108 |
+
"source": [
|
| 109 |
+
"!pip install langchain openai chromadb tiktoken pypdf panel"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"cell_type": "code",
|
| 114 |
+
"execution_count": 2,
|
| 115 |
+
"id": "dcbbf6df",
|
| 116 |
+
"metadata": {},
|
| 117 |
+
"outputs": [
|
| 118 |
+
{
|
| 119 |
+
"data": {
|
| 120 |
+
"application/javascript": [
|
| 121 |
+
"(function(root) {\n",
|
| 122 |
+
" function now() {\n",
|
| 123 |
+
" return new Date();\n",
|
| 124 |
+
" }\n",
|
| 125 |
+
"\n",
|
| 126 |
+
" var force = true;\n",
|
| 127 |
+
"\n",
|
| 128 |
+
" if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
|
| 129 |
+
" root._bokeh_onload_callbacks = [];\n",
|
| 130 |
+
" root._bokeh_is_loading = undefined;\n",
|
| 131 |
+
" }\n",
|
| 132 |
+
"\n",
|
| 133 |
+
" if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
|
| 134 |
+
" root._bokeh_timeout = Date.now() + 5000;\n",
|
| 135 |
+
" root._bokeh_failed_load = false;\n",
|
| 136 |
+
" }\n",
|
| 137 |
+
"\n",
|
| 138 |
+
" function run_callbacks() {\n",
|
| 139 |
+
" try {\n",
|
| 140 |
+
" root._bokeh_onload_callbacks.forEach(function(callback) {\n",
|
| 141 |
+
" if (callback != null)\n",
|
| 142 |
+
" callback();\n",
|
| 143 |
+
" });\n",
|
| 144 |
+
" } finally {\n",
|
| 145 |
+
" delete root._bokeh_onload_callbacks\n",
|
| 146 |
+
" }\n",
|
| 147 |
+
" console.debug(\"Bokeh: all callbacks have finished\");\n",
|
| 148 |
+
" }\n",
|
| 149 |
+
"\n",
|
| 150 |
+
" function load_libs(css_urls, js_urls, js_modules, callback) {\n",
|
| 151 |
+
" if (css_urls == null) css_urls = [];\n",
|
| 152 |
+
" if (js_urls == null) js_urls = [];\n",
|
| 153 |
+
" if (js_modules == null) js_modules = [];\n",
|
| 154 |
+
"\n",
|
| 155 |
+
" root._bokeh_onload_callbacks.push(callback);\n",
|
| 156 |
+
" if (root._bokeh_is_loading > 0) {\n",
|
| 157 |
+
" console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
|
| 158 |
+
" return null;\n",
|
| 159 |
+
" }\n",
|
| 160 |
+
" if (js_urls.length === 0 && js_modules.length === 0) {\n",
|
| 161 |
+
" run_callbacks();\n",
|
| 162 |
+
" return null;\n",
|
| 163 |
+
" }\n",
|
| 164 |
+
" console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
|
| 165 |
+
"\n",
|
| 166 |
+
" function on_load() {\n",
|
| 167 |
+
" root._bokeh_is_loading--;\n",
|
| 168 |
+
" if (root._bokeh_is_loading === 0) {\n",
|
| 169 |
+
" console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
|
| 170 |
+
" run_callbacks()\n",
|
| 171 |
+
" }\n",
|
| 172 |
+
" }\n",
|
| 173 |
+
"\n",
|
| 174 |
+
" function on_error() {\n",
|
| 175 |
+
" console.error(\"failed to load \" + url);\n",
|
| 176 |
+
" }\n",
|
| 177 |
+
"\n",
|
| 178 |
+
" for (var i = 0; i < css_urls.length; i++) {\n",
|
| 179 |
+
" var url = css_urls[i];\n",
|
| 180 |
+
" const element = document.createElement(\"link\");\n",
|
| 181 |
+
" element.onload = on_load;\n",
|
| 182 |
+
" element.onerror = on_error;\n",
|
| 183 |
+
" element.rel = \"stylesheet\";\n",
|
| 184 |
+
" element.type = \"text/css\";\n",
|
| 185 |
+
" element.href = url;\n",
|
| 186 |
+
" console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
|
| 187 |
+
" document.body.appendChild(element);\n",
|
| 188 |
+
" }\n",
|
| 189 |
+
"\n",
|
| 190 |
+
" var skip = [];\n",
|
| 191 |
+
" if (window.requirejs) {\n",
|
| 192 |
+
" 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",
|
| 193 |
+
" require([\"Quill\"], function(Quill) {\n",
|
| 194 |
+
"\twindow.Quill = Quill\n",
|
| 195 |
+
"\ton_load()\n",
|
| 196 |
+
" })\n",
|
| 197 |
+
" require([\"gridstack\"], function(GridStack) {\n",
|
| 198 |
+
"\twindow.GridStack = GridStack\n",
|
| 199 |
+
"\ton_load()\n",
|
| 200 |
+
" })\n",
|
| 201 |
+
" require([\"notyf\"], function() {\n",
|
| 202 |
+
"\ton_load()\n",
|
| 203 |
+
" })\n",
|
| 204 |
+
" root._bokeh_is_loading = css_urls.length + 3;\n",
|
| 205 |
+
" } else {\n",
|
| 206 |
+
" root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n",
|
| 207 |
+
" } if (((window['Quill'] !== undefined) && (!(window['Quill'] instanceof HTMLElement))) || window.requirejs) {\n",
|
| 208 |
+
" var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/quillinput/1.3.6/quill.js'];\n",
|
| 209 |
+
" for (var i = 0; i < urls.length; i++) {\n",
|
| 210 |
+
" skip.push(urls[i])\n",
|
| 211 |
+
" }\n",
|
| 212 |
+
" } if (((window['GridStack'] !== undefined) && (!(window['GridStack'] instanceof HTMLElement))) || window.requirejs) {\n",
|
| 213 |
+
" var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/gridstack/gridstack@4.2.5/dist/gridstack-h5.js'];\n",
|
| 214 |
+
" for (var i = 0; i < urls.length; i++) {\n",
|
| 215 |
+
" skip.push(urls[i])\n",
|
| 216 |
+
" }\n",
|
| 217 |
+
" } if (((window['Notyf'] !== undefined) && (!(window['Notyf'] instanceof HTMLElement))) || window.requirejs) {\n",
|
| 218 |
+
" var urls = ['https://cdn.holoviz.org/panel/0.14.4/dist/bundled/notificationarea/notyf@3/notyf.min.js'];\n",
|
| 219 |
+
" for (var i = 0; i < urls.length; i++) {\n",
|
| 220 |
+
" skip.push(urls[i])\n",
|
| 221 |
+
" }\n",
|
| 222 |
+
" } for (var i = 0; i < js_urls.length; i++) {\n",
|
| 223 |
+
" var url = js_urls[i];\n",
|
| 224 |
+
" if (skip.indexOf(url) >= 0) {\n",
|
| 225 |
+
"\tif (!window.requirejs) {\n",
|
| 226 |
+
"\t on_load();\n",
|
| 227 |
+
"\t}\n",
|
| 228 |
+
"\tcontinue;\n",
|
| 229 |
+
" }\n",
|
| 230 |
+
" var element = document.createElement('script');\n",
|
| 231 |
+
" element.onload = on_load;\n",
|
| 232 |
+
" element.onerror = on_error;\n",
|
| 233 |
+
" element.async = false;\n",
|
| 234 |
+
" element.src = url;\n",
|
| 235 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 236 |
+
" document.head.appendChild(element);\n",
|
| 237 |
+
" }\n",
|
| 238 |
+
" for (var i = 0; i < js_modules.length; i++) {\n",
|
| 239 |
+
" var url = js_modules[i];\n",
|
| 240 |
+
" if (skip.indexOf(url) >= 0) {\n",
|
| 241 |
+
"\tif (!window.requirejs) {\n",
|
| 242 |
+
"\t on_load();\n",
|
| 243 |
+
"\t}\n",
|
| 244 |
+
"\tcontinue;\n",
|
| 245 |
+
" }\n",
|
| 246 |
+
" var element = document.createElement('script');\n",
|
| 247 |
+
" element.onload = on_load;\n",
|
| 248 |
+
" element.onerror = on_error;\n",
|
| 249 |
+
" element.async = false;\n",
|
| 250 |
+
" element.src = url;\n",
|
| 251 |
+
" element.type = \"module\";\n",
|
| 252 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 253 |
+
" document.head.appendChild(element);\n",
|
| 254 |
+
" }\n",
|
| 255 |
+
" if (!js_urls.length && !js_modules.length) {\n",
|
| 256 |
+
" on_load()\n",
|
| 257 |
+
" }\n",
|
| 258 |
+
" };\n",
|
| 259 |
+
"\n",
|
| 260 |
+
" function inject_raw_css(css) {\n",
|
| 261 |
+
" const element = document.createElement(\"style\");\n",
|
| 262 |
+
" element.appendChild(document.createTextNode(css));\n",
|
| 263 |
+
" document.body.appendChild(element);\n",
|
| 264 |
+
" }\n",
|
| 265 |
+
"\n",
|
| 266 |
+
" 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",
|
| 267 |
+
" var js_modules = [];\n",
|
| 268 |
+
" 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/debugger.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/alerts.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/card.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/json.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/loading.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/dataframe.css\"];\n",
|
| 269 |
+
" var inline_js = [ function(Bokeh) {\n",
|
| 270 |
+
" 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",
|
| 271 |
+
" }, function(Bokeh) {\n",
|
| 272 |
+
" Bokeh.set_log_level(\"info\");\n",
|
| 273 |
+
" },\n",
|
| 274 |
+
"function(Bokeh) {} // ensure no trailing comma for IE\n",
|
| 275 |
+
" ];\n",
|
| 276 |
+
"\n",
|
| 277 |
+
" function run_inline_js() {\n",
|
| 278 |
+
" if ((root.Bokeh !== undefined) || (force === true)) {\n",
|
| 279 |
+
" for (var i = 0; i < inline_js.length; i++) {\n",
|
| 280 |
+
" inline_js[i].call(root, root.Bokeh);\n",
|
| 281 |
+
" }} else if (Date.now() < root._bokeh_timeout) {\n",
|
| 282 |
+
" setTimeout(run_inline_js, 100);\n",
|
| 283 |
+
" } else if (!root._bokeh_failed_load) {\n",
|
| 284 |
+
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
|
| 285 |
+
" root._bokeh_failed_load = true;\n",
|
| 286 |
+
" }\n",
|
| 287 |
+
" }\n",
|
| 288 |
+
"\n",
|
| 289 |
+
" if (root._bokeh_is_loading === 0) {\n",
|
| 290 |
+
" console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
|
| 291 |
+
" run_inline_js();\n",
|
| 292 |
+
" } else {\n",
|
| 293 |
+
" load_libs(css_urls, js_urls, js_modules, function() {\n",
|
| 294 |
+
" console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
|
| 295 |
+
" run_inline_js();\n",
|
| 296 |
+
" });\n",
|
| 297 |
+
" }\n",
|
| 298 |
+
"}(window));"
|
| 299 |
+
],
|
| 300 |
+
"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/debugger.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/alerts.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/card.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/json.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/loading.css\", \"https://cdn.holoviz.org/panel/0.14.4/dist/css/dataframe.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));"
|
| 301 |
+
},
|
| 302 |
+
"metadata": {},
|
| 303 |
+
"output_type": "display_data"
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"data": {
|
| 307 |
+
"application/javascript": [
|
| 308 |
+
"\n",
|
| 309 |
+
"if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n",
|
| 310 |
+
" window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n",
|
| 311 |
+
"}\n",
|
| 312 |
+
"\n",
|
| 313 |
+
"\n",
|
| 314 |
+
" function JupyterCommManager() {\n",
|
| 315 |
+
" }\n",
|
| 316 |
+
"\n",
|
| 317 |
+
" JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n",
|
| 318 |
+
" if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n",
|
| 319 |
+
" var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n",
|
| 320 |
+
" comm_manager.register_target(comm_id, function(comm) {\n",
|
| 321 |
+
" comm.on_msg(msg_handler);\n",
|
| 322 |
+
" });\n",
|
| 323 |
+
" } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n",
|
| 324 |
+
" window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n",
|
| 325 |
+
" comm.onMsg = msg_handler;\n",
|
| 326 |
+
" });\n",
|
| 327 |
+
" } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n",
|
| 328 |
+
" google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n",
|
| 329 |
+
" var messages = comm.messages[Symbol.asyncIterator]();\n",
|
| 330 |
+
" function processIteratorResult(result) {\n",
|
| 331 |
+
" var message = result.value;\n",
|
| 332 |
+
" console.log(message)\n",
|
| 333 |
+
" var content = {data: message.data, comm_id};\n",
|
| 334 |
+
" var buffers = []\n",
|
| 335 |
+
" for (var buffer of message.buffers || []) {\n",
|
| 336 |
+
" buffers.push(new DataView(buffer))\n",
|
| 337 |
+
" }\n",
|
| 338 |
+
" var metadata = message.metadata || {};\n",
|
| 339 |
+
" var msg = {content, buffers, metadata}\n",
|
| 340 |
+
" msg_handler(msg);\n",
|
| 341 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 342 |
+
" }\n",
|
| 343 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 344 |
+
" })\n",
|
| 345 |
+
" }\n",
|
| 346 |
+
" }\n",
|
| 347 |
+
"\n",
|
| 348 |
+
" JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n",
|
| 349 |
+
" if (comm_id in window.PyViz.comms) {\n",
|
| 350 |
+
" return window.PyViz.comms[comm_id];\n",
|
| 351 |
+
" } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n",
|
| 352 |
+
" var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n",
|
| 353 |
+
" var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n",
|
| 354 |
+
" if (msg_handler) {\n",
|
| 355 |
+
" comm.on_msg(msg_handler);\n",
|
| 356 |
+
" }\n",
|
| 357 |
+
" } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n",
|
| 358 |
+
" var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n",
|
| 359 |
+
" comm.open();\n",
|
| 360 |
+
" if (msg_handler) {\n",
|
| 361 |
+
" comm.onMsg = msg_handler;\n",
|
| 362 |
+
" }\n",
|
| 363 |
+
" } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n",
|
| 364 |
+
" var comm_promise = google.colab.kernel.comms.open(comm_id)\n",
|
| 365 |
+
" comm_promise.then((comm) => {\n",
|
| 366 |
+
" window.PyViz.comms[comm_id] = comm;\n",
|
| 367 |
+
" if (msg_handler) {\n",
|
| 368 |
+
" var messages = comm.messages[Symbol.asyncIterator]();\n",
|
| 369 |
+
" function processIteratorResult(result) {\n",
|
| 370 |
+
" var message = result.value;\n",
|
| 371 |
+
" var content = {data: message.data};\n",
|
| 372 |
+
" var metadata = message.metadata || {comm_id};\n",
|
| 373 |
+
" var msg = {content, metadata}\n",
|
| 374 |
+
" msg_handler(msg);\n",
|
| 375 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 376 |
+
" }\n",
|
| 377 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 378 |
+
" }\n",
|
| 379 |
+
" }) \n",
|
| 380 |
+
" var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n",
|
| 381 |
+
" return comm_promise.then((comm) => {\n",
|
| 382 |
+
" comm.send(data, metadata, buffers, disposeOnDone);\n",
|
| 383 |
+
" });\n",
|
| 384 |
+
" };\n",
|
| 385 |
+
" var comm = {\n",
|
| 386 |
+
" send: sendClosure\n",
|
| 387 |
+
" };\n",
|
| 388 |
+
" }\n",
|
| 389 |
+
" window.PyViz.comms[comm_id] = comm;\n",
|
| 390 |
+
" return comm;\n",
|
| 391 |
+
" }\n",
|
| 392 |
+
" window.PyViz.comm_manager = new JupyterCommManager();\n",
|
| 393 |
+
" \n",
|
| 394 |
+
"\n",
|
| 395 |
+
"\n",
|
| 396 |
+
"var JS_MIME_TYPE = 'application/javascript';\n",
|
| 397 |
+
"var HTML_MIME_TYPE = 'text/html';\n",
|
| 398 |
+
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
| 399 |
+
"var CLASS_NAME = 'output';\n",
|
| 400 |
+
"\n",
|
| 401 |
+
"/**\n",
|
| 402 |
+
" * Render data to the DOM node\n",
|
| 403 |
+
" */\n",
|
| 404 |
+
"function render(props, node) {\n",
|
| 405 |
+
" var div = document.createElement(\"div\");\n",
|
| 406 |
+
" var script = document.createElement(\"script\");\n",
|
| 407 |
+
" node.appendChild(div);\n",
|
| 408 |
+
" node.appendChild(script);\n",
|
| 409 |
+
"}\n",
|
| 410 |
+
"\n",
|
| 411 |
+
"/**\n",
|
| 412 |
+
" * Handle when a new output is added\n",
|
| 413 |
+
" */\n",
|
| 414 |
+
"function handle_add_output(event, handle) {\n",
|
| 415 |
+
" var output_area = handle.output_area;\n",
|
| 416 |
+
" var output = handle.output;\n",
|
| 417 |
+
" if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
|
| 418 |
+
" return\n",
|
| 419 |
+
" }\n",
|
| 420 |
+
" var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
|
| 421 |
+
" var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
|
| 422 |
+
" if (id !== undefined) {\n",
|
| 423 |
+
" var nchildren = toinsert.length;\n",
|
| 424 |
+
" var html_node = toinsert[nchildren-1].children[0];\n",
|
| 425 |
+
" html_node.innerHTML = output.data[HTML_MIME_TYPE];\n",
|
| 426 |
+
" var scripts = [];\n",
|
| 427 |
+
" var nodelist = html_node.querySelectorAll(\"script\");\n",
|
| 428 |
+
" for (var i in nodelist) {\n",
|
| 429 |
+
" if (nodelist.hasOwnProperty(i)) {\n",
|
| 430 |
+
" scripts.push(nodelist[i])\n",
|
| 431 |
+
" }\n",
|
| 432 |
+
" }\n",
|
| 433 |
+
"\n",
|
| 434 |
+
" scripts.forEach( function (oldScript) {\n",
|
| 435 |
+
" var newScript = document.createElement(\"script\");\n",
|
| 436 |
+
" var attrs = [];\n",
|
| 437 |
+
" var nodemap = oldScript.attributes;\n",
|
| 438 |
+
" for (var j in nodemap) {\n",
|
| 439 |
+
" if (nodemap.hasOwnProperty(j)) {\n",
|
| 440 |
+
" attrs.push(nodemap[j])\n",
|
| 441 |
+
" }\n",
|
| 442 |
+
" }\n",
|
| 443 |
+
" attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n",
|
| 444 |
+
" newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n",
|
| 445 |
+
" oldScript.parentNode.replaceChild(newScript, oldScript);\n",
|
| 446 |
+
" });\n",
|
| 447 |
+
" if (JS_MIME_TYPE in output.data) {\n",
|
| 448 |
+
" toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n",
|
| 449 |
+
" }\n",
|
| 450 |
+
" output_area._hv_plot_id = id;\n",
|
| 451 |
+
" if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n",
|
| 452 |
+
" window.PyViz.plot_index[id] = Bokeh.index[id];\n",
|
| 453 |
+
" } else {\n",
|
| 454 |
+
" window.PyViz.plot_index[id] = null;\n",
|
| 455 |
+
" }\n",
|
| 456 |
+
" } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
|
| 457 |
+
" var bk_div = document.createElement(\"div\");\n",
|
| 458 |
+
" bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
|
| 459 |
+
" var script_attrs = bk_div.children[0].attributes;\n",
|
| 460 |
+
" for (var i = 0; i < script_attrs.length; i++) {\n",
|
| 461 |
+
" toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
|
| 462 |
+
" }\n",
|
| 463 |
+
" // store reference to server id on output_area\n",
|
| 464 |
+
" output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
|
| 465 |
+
" }\n",
|
| 466 |
+
"}\n",
|
| 467 |
+
"\n",
|
| 468 |
+
"/**\n",
|
| 469 |
+
" * Handle when an output is cleared or removed\n",
|
| 470 |
+
" */\n",
|
| 471 |
+
"function handle_clear_output(event, handle) {\n",
|
| 472 |
+
" var id = handle.cell.output_area._hv_plot_id;\n",
|
| 473 |
+
" var server_id = handle.cell.output_area._bokeh_server_id;\n",
|
| 474 |
+
" if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n",
|
| 475 |
+
" var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n",
|
| 476 |
+
" if (server_id !== null) {\n",
|
| 477 |
+
" comm.send({event_type: 'server_delete', 'id': server_id});\n",
|
| 478 |
+
" return;\n",
|
| 479 |
+
" } else if (comm !== null) {\n",
|
| 480 |
+
" comm.send({event_type: 'delete', 'id': id});\n",
|
| 481 |
+
" }\n",
|
| 482 |
+
" delete PyViz.plot_index[id];\n",
|
| 483 |
+
" if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n",
|
| 484 |
+
" var doc = window.Bokeh.index[id].model.document\n",
|
| 485 |
+
" doc.clear();\n",
|
| 486 |
+
" const i = window.Bokeh.documents.indexOf(doc);\n",
|
| 487 |
+
" if (i > -1) {\n",
|
| 488 |
+
" window.Bokeh.documents.splice(i, 1);\n",
|
| 489 |
+
" }\n",
|
| 490 |
+
" }\n",
|
| 491 |
+
"}\n",
|
| 492 |
+
"\n",
|
| 493 |
+
"/**\n",
|
| 494 |
+
" * Handle kernel restart event\n",
|
| 495 |
+
" */\n",
|
| 496 |
+
"function handle_kernel_cleanup(event, handle) {\n",
|
| 497 |
+
" delete PyViz.comms[\"hv-extension-comm\"];\n",
|
| 498 |
+
" window.PyViz.plot_index = {}\n",
|
| 499 |
+
"}\n",
|
| 500 |
+
"\n",
|
| 501 |
+
"/**\n",
|
| 502 |
+
" * Handle update_display_data messages\n",
|
| 503 |
+
" */\n",
|
| 504 |
+
"function handle_update_output(event, handle) {\n",
|
| 505 |
+
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
| 506 |
+
" handle_add_output(event, handle)\n",
|
| 507 |
+
"}\n",
|
| 508 |
+
"\n",
|
| 509 |
+
"function register_renderer(events, OutputArea) {\n",
|
| 510 |
+
" function append_mime(data, metadata, element) {\n",
|
| 511 |
+
" // create a DOM node to render to\n",
|
| 512 |
+
" var toinsert = this.create_output_subarea(\n",
|
| 513 |
+
" metadata,\n",
|
| 514 |
+
" CLASS_NAME,\n",
|
| 515 |
+
" EXEC_MIME_TYPE\n",
|
| 516 |
+
" );\n",
|
| 517 |
+
" this.keyboard_manager.register_events(toinsert);\n",
|
| 518 |
+
" // Render to node\n",
|
| 519 |
+
" var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
|
| 520 |
+
" render(props, toinsert[0]);\n",
|
| 521 |
+
" element.append(toinsert);\n",
|
| 522 |
+
" return toinsert\n",
|
| 523 |
+
" }\n",
|
| 524 |
+
"\n",
|
| 525 |
+
" events.on('output_added.OutputArea', handle_add_output);\n",
|
| 526 |
+
" events.on('output_updated.OutputArea', handle_update_output);\n",
|
| 527 |
+
" events.on('clear_output.CodeCell', handle_clear_output);\n",
|
| 528 |
+
" events.on('delete.Cell', handle_clear_output);\n",
|
| 529 |
+
" events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n",
|
| 530 |
+
"\n",
|
| 531 |
+
" OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
|
| 532 |
+
" safe: true,\n",
|
| 533 |
+
" index: 0\n",
|
| 534 |
+
" });\n",
|
| 535 |
+
"}\n",
|
| 536 |
+
"\n",
|
| 537 |
+
"if (window.Jupyter !== undefined) {\n",
|
| 538 |
+
" try {\n",
|
| 539 |
+
" var events = require('base/js/events');\n",
|
| 540 |
+
" var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
|
| 541 |
+
" if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
|
| 542 |
+
" register_renderer(events, OutputArea);\n",
|
| 543 |
+
" }\n",
|
| 544 |
+
" } catch(err) {\n",
|
| 545 |
+
" }\n",
|
| 546 |
+
"}\n"
|
| 547 |
+
],
|
| 548 |
+
"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"
|
| 549 |
+
},
|
| 550 |
+
"metadata": {},
|
| 551 |
+
"output_type": "display_data"
|
| 552 |
+
},
|
| 553 |
+
{
|
| 554 |
+
"data": {
|
| 555 |
+
"text/html": [
|
| 556 |
+
"<style>.bk-root, .bk-root .bk:before, .bk-root .bk:after {\n",
|
| 557 |
+
" font-family: var(--jp-ui-font-size1);\n",
|
| 558 |
+
" font-size: var(--jp-ui-font-size1);\n",
|
| 559 |
+
" color: var(--jp-ui-font-color1);\n",
|
| 560 |
+
"}\n",
|
| 561 |
+
"</style>"
|
| 562 |
+
]
|
| 563 |
+
},
|
| 564 |
+
"metadata": {},
|
| 565 |
+
"output_type": "display_data"
|
| 566 |
+
}
|
| 567 |
+
],
|
| 568 |
+
"source": [
|
| 569 |
+
"import os\n",
|
| 570 |
+
"from langchain.chains import RetrievalQA\n",
|
| 571 |
+
"from langchain.llms import OpenAI\n",
|
| 572 |
+
"from langchain.document_loaders import TextLoader\n",
|
| 573 |
+
"from langchain.document_loaders import PyPDFLoader\n",
|
| 574 |
+
"from langchain.indexes import VectorstoreIndexCreator\n",
|
| 575 |
+
"from langchain.text_splitter import CharacterTextSplitter\n",
|
| 576 |
+
"from langchain.embeddings import OpenAIEmbeddings\n",
|
| 577 |
+
"from langchain.vectorstores import Chroma\n",
|
| 578 |
+
"import panel as pn\n",
|
| 579 |
+
"pn.extension ('texteditor', template=\"bootstrap\", sizing_mode='stretch_width')\n",
|
| 580 |
+
"pn.state.template.param.update(\n",
|
| 581 |
+
" main_max_width=\"690px\",\n",
|
| 582 |
+
" header_background=\"#F08080\",\n",
|
| 583 |
+
")"
|
| 584 |
+
]
|
| 585 |
+
},
|
| 586 |
+
{
|
| 587 |
+
"cell_type": "code",
|
| 588 |
+
"execution_count": 3,
|
| 589 |
+
"id": "fcd48f62",
|
| 590 |
+
"metadata": {},
|
| 591 |
+
"outputs": [],
|
| 592 |
+
"source": [
|
| 593 |
+
"import panel as pn\n",
|
| 594 |
+
"\n",
|
| 595 |
+
"file_input = pn.widgets.FileInput(width=300)\n",
|
| 596 |
+
"openaikey = pn.widgets.PasswordInput(\n",
|
| 597 |
+
" value=\"\", placeholder=\"Enter your OpenAI API Key here...\", width=300\n",
|
| 598 |
+
")\n",
|
| 599 |
+
"prompt = pn.widgets.TextEditor(\n",
|
| 600 |
+
" value='', placeholder=\"Enter your questions here...\", height=160, toolbar=False\n",
|
| 601 |
+
")\n",
|
| 602 |
+
"run_button = pn.widgets.Button(name=\"Run!\")\n",
|
| 603 |
+
"\n",
|
| 604 |
+
"select_k = pn.widgets.IntSlider(\n",
|
| 605 |
+
" name=\"Number of relevant chunks\", start=1, end=5, step=1, value=2\n",
|
| 606 |
+
")\n",
|
| 607 |
+
"select_chain_type = pn.widgets.RadioButtonGroup(\n",
|
| 608 |
+
" name='Chain type',\n",
|
| 609 |
+
" options=['stuff', 'map_reduce', \"refine\", \"map_rerank\"]\n",
|
| 610 |
+
")\n",
|
| 611 |
+
"widgets = pn.Row(\n",
|
| 612 |
+
" pn.Column(prompt, run_button, margin=5),\n",
|
| 613 |
+
" pn.Card(\n",
|
| 614 |
+
" pn.Column(\"Chain type:\", select_chain_type, select_k),\n",
|
| 615 |
+
" title=\"Advanced settings\", margin=10\n",
|
| 616 |
+
" ), width=600\n",
|
| 617 |
+
")"
|
| 618 |
+
]
|
| 619 |
+
},
|
| 620 |
+
{
|
| 621 |
+
"cell_type": "code",
|
| 622 |
+
"execution_count": 4,
|
| 623 |
+
"id": "dd7114ba",
|
| 624 |
+
"metadata": {},
|
| 625 |
+
"outputs": [],
|
| 626 |
+
"source": [
|
| 627 |
+
"def qa(file, query, chain_type, k):\n",
|
| 628 |
+
"# load document\n",
|
| 629 |
+
" loader = PyPDFLoader(file)\n",
|
| 630 |
+
" documents = loader.load()\n",
|
| 631 |
+
"# split the documents into chunks\n",
|
| 632 |
+
" text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n",
|
| 633 |
+
" texts = text_splitter.split_documents(documents)\n",
|
| 634 |
+
"# select which embeddings we want to use\n",
|
| 635 |
+
" embeddings = OpenAIEmbeddings()\n",
|
| 636 |
+
"# create the vectorestore to use as the index\n",
|
| 637 |
+
" b = Chroma.from_documents(texts, embeddings)\n",
|
| 638 |
+
"# expose this index in a retriever interface\n",
|
| 639 |
+
" retriever = db.as_retriever(search_type=\"similarity\", search_kwargs={\"k\": k})\n",
|
| 640 |
+
"# create a chain to answer questions\n",
|
| 641 |
+
" qa = RetrievalQA.from_chain_type(\n",
|
| 642 |
+
" llm = OpenAI(), chain_type = chain_type, retriever=retriever, return_source_documents=True)\n",
|
| 643 |
+
" result = qa({\"query\": query})\n",
|
| 644 |
+
" print (result ['result'])\n",
|
| 645 |
+
" return result"
|
| 646 |
+
]
|
| 647 |
+
},
|
| 648 |
+
{
|
| 649 |
+
"cell_type": "code",
|
| 650 |
+
"execution_count": 5,
|
| 651 |
+
"id": "f0d05516",
|
| 652 |
+
"metadata": {},
|
| 653 |
+
"outputs": [
|
| 654 |
+
{
|
| 655 |
+
"data": {},
|
| 656 |
+
"metadata": {},
|
| 657 |
+
"output_type": "display_data"
|
| 658 |
+
},
|
| 659 |
+
{
|
| 660 |
+
"data": {
|
| 661 |
+
"application/vnd.holoviews_exec.v0+json": "",
|
| 662 |
+
"text/html": [
|
| 663 |
+
"<div id='1002'>\n",
|
| 664 |
+
" <div class=\"bk-root\" id=\"2c4c2cc8-1a02-45fe-8d30-e716654592a9\" data-root-id=\"1002\"></div>\n",
|
| 665 |
+
"</div>\n",
|
| 666 |
+
"<script type=\"application/javascript\">(function(root) {\n",
|
| 667 |
+
" function embed_document(root) {\n",
|
| 668 |
+
" var docs_json = {\"419de70a-56db-4acb-b656-37b21ce66579\":{\"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\":{\"client_comm_id\":\"2f1f9300e11c4ab299196b99237bc938\",\"comm_id\":\"4dd3b41cc96b40c2a579ecf230025936\",\"plot_id\":\"1002\"},\"id\":\"1003\",\"type\":\"panel.models.comm_manager.CommManager\"},{\"attributes\":{\"margin\":[5,10,5,10],\"min_width\":300,\"width\":300},\"id\":\"1002\",\"type\":\"FileInput\"},{\"attributes\":{\"reload\":false},\"id\":\"1004\",\"type\":\"panel.models.location.Location\"}],\"root_ids\":[\"1002\",\"1003\",\"1004\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n",
|
| 669 |
+
" var render_items = [{\"docid\":\"419de70a-56db-4acb-b656-37b21ce66579\",\"root_ids\":[\"1002\"],\"roots\":{\"1002\":\"2c4c2cc8-1a02-45fe-8d30-e716654592a9\"}}];\n",
|
| 670 |
+
" root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
|
| 671 |
+
" for (const render_item of render_items) {\n",
|
| 672 |
+
" for (const root_id of render_item.root_ids) {\n",
|
| 673 |
+
"\tconst id_el = document.getElementById(root_id)\n",
|
| 674 |
+
"\tif (id_el.children.length && (id_el.children[0].className === 'bk-root')) {\n",
|
| 675 |
+
"\t const root_el = id_el.children[0]\n",
|
| 676 |
+
"\t root_el.id = root_el.id + '-rendered'\n",
|
| 677 |
+
"\t}\n",
|
| 678 |
+
" }\n",
|
| 679 |
+
" }\n",
|
| 680 |
+
" }\n",
|
| 681 |
+
" if (root.Bokeh !== undefined && root.Bokeh.Panel !== undefined) {\n",
|
| 682 |
+
" embed_document(root);\n",
|
| 683 |
+
" } else {\n",
|
| 684 |
+
" var attempts = 0;\n",
|
| 685 |
+
" var timer = setInterval(function(root) {\n",
|
| 686 |
+
" if (root.Bokeh !== undefined && root.Bokeh.Panel !== undefined) {\n",
|
| 687 |
+
" clearInterval(timer);\n",
|
| 688 |
+
" embed_document(root);\n",
|
| 689 |
+
" } else if (document.readyState == \"complete\") {\n",
|
| 690 |
+
" attempts++;\n",
|
| 691 |
+
" if (attempts > 200) {\n",
|
| 692 |
+
" clearInterval(timer);\n",
|
| 693 |
+
" console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
|
| 694 |
+
" }\n",
|
| 695 |
+
" }\n",
|
| 696 |
+
" }, 25, root)\n",
|
| 697 |
+
" }\n",
|
| 698 |
+
"})(window);</script>"
|
| 699 |
+
],
|
| 700 |
+
"text/plain": [
|
| 701 |
+
"FileInput(width=300)"
|
| 702 |
+
]
|
| 703 |
+
},
|
| 704 |
+
"execution_count": 5,
|
| 705 |
+
"metadata": {
|
| 706 |
+
"application/vnd.holoviews_exec.v0+json": {
|
| 707 |
+
"id": "1002"
|
| 708 |
+
}
|
| 709 |
+
},
|
| 710 |
+
"output_type": "execute_result"
|
| 711 |
+
}
|
| 712 |
+
],
|
| 713 |
+
"source": [
|
| 714 |
+
"file_input"
|
| 715 |
+
]
|
| 716 |
+
},
|
| 717 |
+
{
|
| 718 |
+
"cell_type": "code",
|
| 719 |
+
"execution_count": 6,
|
| 720 |
+
"id": "8ef4ae70",
|
| 721 |
+
"metadata": {},
|
| 722 |
+
"outputs": [],
|
| 723 |
+
"source": [
|
| 724 |
+
"convos = [] # store all panel objects in a list\n",
|
| 725 |
+
"def qa_result(_):\n",
|
| 726 |
+
" os.environ[\"'OPENAI_API_KEY\"] = openaikey.value\n",
|
| 727 |
+
"\n",
|
| 728 |
+
" # save pdf file to a temp file\n",
|
| 729 |
+
" if file_input.value is not None:\n",
|
| 730 |
+
" file_input.save (\"/.cache/temp.pdf\")\n",
|
| 731 |
+
"\n",
|
| 732 |
+
" prompt_text = prompt.value\n",
|
| 733 |
+
" if prompt_text:\n",
|
| 734 |
+
" result = qa(file=\"/.cache/temp-pdf\", query=prompt_text, chain_type=select_chain_type. value, k=select_k.value)\n",
|
| 735 |
+
" convos.extend([\n",
|
| 736 |
+
" pn.Row(\n",
|
| 737 |
+
" pn.panel(\"\\U0001F60A\", width=10),\n",
|
| 738 |
+
" prompt_text,\n",
|
| 739 |
+
" width=600\n",
|
| 740 |
+
" ),\n",
|
| 741 |
+
" pn.Row(\n",
|
| 742 |
+
" pn.panel(\"\\U0001F916\", width=10),\n",
|
| 743 |
+
" pn.Column(\n",
|
| 744 |
+
" result[\"result\"],\n",
|
| 745 |
+
" \"Relevant source text:\",\n",
|
| 746 |
+
" pn.panel.Markdown('\\n----------------------------------------\\n'.join(doc.page_content for doc in result[\"source_documents\"]))\n",
|
| 747 |
+
" )\n",
|
| 748 |
+
" )\n",
|
| 749 |
+
" ])\n",
|
| 750 |
+
" #return convos\n",
|
| 751 |
+
" return pn.Column(*convos, margin=15, width=575, min_height=400)"
|
| 752 |
+
]
|
| 753 |
+
},
|
| 754 |
+
{
|
| 755 |
+
"cell_type": "code",
|
| 756 |
+
"execution_count": 7,
|
| 757 |
+
"id": "6a682e65",
|
| 758 |
+
"metadata": {
|
| 759 |
+
"scrolled": true
|
| 760 |
+
},
|
| 761 |
+
"outputs": [],
|
| 762 |
+
"source": [
|
| 763 |
+
"qa_interactive = pn.panel(\n",
|
| 764 |
+
" pn.bind(qa_result, run_button),\n",
|
| 765 |
+
" loading_indicator=True,\n",
|
| 766 |
+
")"
|
| 767 |
+
]
|
| 768 |
+
},
|
| 769 |
+
{
|
| 770 |
+
"cell_type": "code",
|
| 771 |
+
"execution_count": 8,
|
| 772 |
+
"id": "4258f908",
|
| 773 |
+
"metadata": {},
|
| 774 |
+
"outputs": [],
|
| 775 |
+
"source": [
|
| 776 |
+
"output = pn.WidgetBox('*Output will show up here:*', qa_interactive, width=630, scroll=True)"
|
| 777 |
+
]
|
| 778 |
+
},
|
| 779 |
+
{
|
| 780 |
+
"cell_type": "code",
|
| 781 |
+
"execution_count": 9,
|
| 782 |
+
"id": "42a031d1",
|
| 783 |
+
"metadata": {
|
| 784 |
+
"scrolled": true
|
| 785 |
+
},
|
| 786 |
+
"outputs": [
|
| 787 |
+
{
|
| 788 |
+
"data": {},
|
| 789 |
+
"metadata": {},
|
| 790 |
+
"output_type": "display_data"
|
| 791 |
+
},
|
| 792 |
+
{
|
| 793 |
+
"data": {
|
| 794 |
+
"application/vnd.holoviews_exec.v0+json": "",
|
| 795 |
+
"text/html": [
|
| 796 |
+
"<div id='1005'>\n",
|
| 797 |
+
" <div class=\"bk-root\" id=\"c2b6d391-2418-4059-a838-b20218c1be11\" data-root-id=\"1005\"></div>\n",
|
| 798 |
+
"</div>\n",
|
| 799 |
+
"<script type=\"application/javascript\">(function(root) {\n",
|
| 800 |
+
" function embed_document(root) {\n",
|
| 801 |
+
" var docs_json = {\"d0252f16-7a5e-460a-82c3-6b7db2f9af2a\":{\"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\":{\"margin\":[5,10,5,10],\"min_width\":300,\"width\":300},\"id\":\"1008\",\"type\":\"FileInput\"},{\"attributes\":{\"children\":[{\"id\":\"1015\"},{\"id\":\"1018\"}],\"margin\":[0,0,0,0],\"min_width\":600,\"name\":\"Row00135\",\"width\":600},\"id\":\"1014\",\"type\":\"Row\"},{\"attributes\":{\"children\":[{\"id\":\"1013\"}],\"margin\":[0,0,0,0],\"name\":\"Row00143\"},\"id\":\"1012\",\"type\":\"Row\"},{\"attributes\":{\"css_classes\":[\"markdown\"],\"margin\":[5,5,5,5],\"name\":\"Markdown00150\",\"sizing_mode\":\"stretch_width\",\"text\":\"<h2>\\ud83d\\ude0a! Question Answering with your PDF file</h2>\\n<p>1) Upload a PDF. 2) Enter OpenAI API key. This costs $. Set up billing at OpenAl. 3) Type a question and click &ldquo;Run&rdquo;.</p>\"},\"id\":\"1006\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"css_classes\":[\"card-title\"],\"margin\":[5,0,5,0],\"name\":\"HTML00133\",\"sizing_mode\":\"stretch_width\",\"text\":\"Advanced settings\"},\"id\":\"1020\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"client_comm_id\":\"636fa13814d14cc7aa2be03345a882c8\",\"comm_id\":\"5d51c478032046488a5141321f68b245\",\"plot_id\":\"1005\"},\"id\":\"1026\",\"type\":\"panel.models.comm_manager.CommManager\"},{\"attributes\":{\"children\":[{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"}],\"margin\":[0,0,0,0],\"name\":\"Column00130\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1021\",\"type\":\"Column\"},{\"attributes\":{\"end\":5,\"margin\":[5,10,5,10],\"sizing_mode\":\"stretch_width\",\"start\":1,\"title\":\"Number of relevant chunks\",\"value\":2},\"id\":\"1024\",\"type\":\"Slider\"},{\"attributes\":{\"children\":[{\"id\":\"1016\"},{\"id\":\"1017\"}],\"margin\":[5,5,5,5],\"name\":\"Column00127\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1015\",\"type\":\"Column\"},{\"attributes\":{\"args\":{\"bidirectional\":false,\"properties\":{\"event:button_click\":\"loading\"},\"source\":{\"id\":\"1017\"},\"target\":{\"id\":\"1012\"}},\"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\":[[4820498704,[null,\"event:button_click\"],[null,\"loading\"]]]},\"id\":\"1025\",\"type\":\"CustomJS\"},{\"attributes\":{\"children\":[{\"id\":\"1020\"}],\"css_classes\":[\"card-header-row\"],\"margin\":[0,0,0,0],\"name\":\"Row00131\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1019\",\"type\":\"Row\"},{\"attributes\":{\"children\":[{\"id\":\"1006\"},{\"id\":\"1007\"},{\"id\":\"1010\"},{\"id\":\"1014\"}],\"margin\":[0,0,0,0],\"name\":\"Column00153\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1005\",\"type\":\"Column\"},{\"attributes\":{\"children\":[{\"id\":\"1011\"},{\"id\":\"1012\"}],\"css_classes\":[\"panel-widget-box\",\"scrollable\"],\"margin\":[5,5,5,5],\"min_width\":630,\"name\":\"WidgetBox00149\",\"width\":630},\"id\":\"1010\",\"type\":\"Column\"},{\"attributes\":{\"css_classes\":[\"markdown\"],\"margin\":[5,5,5,5],\"name\":\"Markdown00147\",\"sizing_mode\":\"stretch_width\",\"text\":\"<p><em>Output will show up here:</em></p>\"},\"id\":\"1011\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"icon\":null,\"js_event_callbacks\":{\"button_click\":[{\"id\":\"1025\"}]},\"label\":\"Run!\",\"margin\":[5,10,5,10],\"sizing_mode\":\"stretch_width\",\"subscribed_events\":[\"button_click\"]},\"id\":\"1017\",\"type\":\"Button\"},{\"attributes\":{\"margin\":[5,10,5,10],\"max_length\":5000,\"min_width\":300,\"placeholder\":\"Enter your OpenAI API Key here...\",\"width\":300},\"id\":\"1009\",\"type\":\"PasswordInput\"},{\"attributes\":{\"active\":0,\"labels\":[\"stuff\",\"map_reduce\",\"refine\",\"map_rerank\"],\"margin\":[5,10,5,10],\"sizing_mode\":\"stretch_width\"},\"id\":\"1023\",\"type\":\"RadioButtonGroup\"},{\"attributes\":{\"children\":[{\"id\":\"1008\"},{\"id\":\"1009\"}],\"margin\":[0,0,0,0],\"name\":\"Row00152\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1007\",\"type\":\"Row\"},{\"attributes\":{\"height\":160,\"margin\":[5,10,5,10],\"name\":\"\",\"placeholder\":\"Enter your questions here...\",\"sizing_mode\":\"stretch_width\",\"toolbar\":false},\"id\":\"1016\",\"type\":\"panel.models.quill.QuillInput\"},{\"attributes\":{\"active_header_background\":\"\",\"button_css_classes\":[\"card-button\"],\"children\":[{\"id\":\"1019\"},{\"id\":\"1021\"}],\"collapsed\":false,\"css_classes\":[\"card\"],\"header_background\":\"\",\"header_color\":\"\",\"header_css_classes\":[\"card-header\"],\"margin\":[10,10,10,10],\"name\":\"Card00132\",\"sizing_mode\":\"stretch_width\"},\"id\":\"1018\",\"type\":\"panel.models.layout.Card\"},{\"attributes\":{\"css_classes\":[\"markdown\"],\"margin\":[5,5,5,5],\"name\":\"Markdown00128\",\"sizing_mode\":\"stretch_width\",\"text\":\"<p>Chain type:</p>\"},\"id\":\"1022\",\"type\":\"panel.models.markup.HTML\"},{\"attributes\":{\"margin\":[15,15,15,15],\"min_height\":400,\"min_width\":575,\"name\":\"Column00145\",\"width\":575},\"id\":\"1013\",\"type\":\"Column\"}],\"root_ids\":[\"1005\",\"1026\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n",
|
| 802 |
+
" var render_items = [{\"docid\":\"d0252f16-7a5e-460a-82c3-6b7db2f9af2a\",\"root_ids\":[\"1005\"],\"roots\":{\"1005\":\"c2b6d391-2418-4059-a838-b20218c1be11\"}}];\n",
|
| 803 |
+
" root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
|
| 804 |
+
" for (const render_item of render_items) {\n",
|
| 805 |
+
" for (const root_id of render_item.root_ids) {\n",
|
| 806 |
+
"\tconst id_el = document.getElementById(root_id)\n",
|
| 807 |
+
"\tif (id_el.children.length && (id_el.children[0].className === 'bk-root')) {\n",
|
| 808 |
+
"\t const root_el = id_el.children[0]\n",
|
| 809 |
+
"\t root_el.id = root_el.id + '-rendered'\n",
|
| 810 |
+
"\t}\n",
|
| 811 |
+
" }\n",
|
| 812 |
+
" }\n",
|
| 813 |
+
" }\n",
|
| 814 |
+
" if (root.Bokeh !== undefined && root.Bokeh.Panel !== undefined) {\n",
|
| 815 |
+
" embed_document(root);\n",
|
| 816 |
+
" } else {\n",
|
| 817 |
+
" var attempts = 0;\n",
|
| 818 |
+
" var timer = setInterval(function(root) {\n",
|
| 819 |
+
" if (root.Bokeh !== undefined && root.Bokeh.Panel !== undefined) {\n",
|
| 820 |
+
" clearInterval(timer);\n",
|
| 821 |
+
" embed_document(root);\n",
|
| 822 |
+
" } else if (document.readyState == \"complete\") {\n",
|
| 823 |
+
" attempts++;\n",
|
| 824 |
+
" if (attempts > 200) {\n",
|
| 825 |
+
" clearInterval(timer);\n",
|
| 826 |
+
" console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
|
| 827 |
+
" }\n",
|
| 828 |
+
" }\n",
|
| 829 |
+
" }, 25, root)\n",
|
| 830 |
+
" }\n",
|
| 831 |
+
"})(window);</script>"
|
| 832 |
+
],
|
| 833 |
+
"text/plain": [
|
| 834 |
+
"Column(sizing_mode='stretch_width')\n",
|
| 835 |
+
" [0] Markdown(str, sizing_mode='stretch_width')\n",
|
| 836 |
+
" [1] Row(sizing_mode='stretch_width')\n",
|
| 837 |
+
" [0] FileInput(width=300)\n",
|
| 838 |
+
" [1] PasswordInput(placeholder='Enter your OpenAI A..., width=300)\n",
|
| 839 |
+
" [2] WidgetBox(scroll=True, width=630)\n",
|
| 840 |
+
" [0] Markdown(str, sizing_mode='stretch_width')\n",
|
| 841 |
+
" [1] ParamFunction(function, _pane=Column, loading_indicator=True, sizing_mode='stretch_width')\n",
|
| 842 |
+
" [3] Row(width=600)\n",
|
| 843 |
+
" [0] Column(margin=5, sizing_mode='stretch_width')\n",
|
| 844 |
+
" [0] TextEditor(height=160, placeholder='Enter your questions h..., sizing_mode='stretch_width', toolbar=False)\n",
|
| 845 |
+
" [1] Button(name='Run!', sizing_mode='stretch_width')\n",
|
| 846 |
+
" [1] Card(margin=10, sizing_mode='stretch_width', title='Advanced settings')\n",
|
| 847 |
+
" [0] Column(sizing_mode='stretch_width')\n",
|
| 848 |
+
" [0] Markdown(str, sizing_mode='stretch_width')\n",
|
| 849 |
+
" [1] RadioButtonGroup(name='Chain type', options=['stuff', 'map_reduce', ...], sizing_mode='stretch_width', value='stuff')\n",
|
| 850 |
+
" [2] IntSlider(end=5, name='Number of relevant c..., sizing_mode='stretch_width', start=1, value=2)"
|
| 851 |
+
]
|
| 852 |
+
},
|
| 853 |
+
"execution_count": 9,
|
| 854 |
+
"metadata": {
|
| 855 |
+
"application/vnd.holoviews_exec.v0+json": {
|
| 856 |
+
"id": "1005"
|
| 857 |
+
}
|
| 858 |
+
},
|
| 859 |
+
"output_type": "execute_result"
|
| 860 |
+
}
|
| 861 |
+
],
|
| 862 |
+
"source": [
|
| 863 |
+
"# layout\n",
|
| 864 |
+
"pn.Column(\n",
|
| 865 |
+
" pn.pane.Markdown (\"\"\"\n",
|
| 866 |
+
" ## \\U0001F60A! Question Answering with your PDF file\n",
|
| 867 |
+
" \n",
|
| 868 |
+
" 1) Upload a PDF. 2) Enter OpenAI API key. This costs $. Set up billing at OpenAl. 3) Type a question and click \"Run\".\n",
|
| 869 |
+
" \n",
|
| 870 |
+
" \"\"\"),\n",
|
| 871 |
+
" pn.Row(file_input, openaikey),\n",
|
| 872 |
+
" output,\n",
|
| 873 |
+
" widgets\n",
|
| 874 |
+
").servable()"
|
| 875 |
+
]
|
| 876 |
+
},
|
| 877 |
+
{
|
| 878 |
+
"cell_type": "code",
|
| 879 |
+
"execution_count": null,
|
| 880 |
+
"id": "56cffd14",
|
| 881 |
+
"metadata": {},
|
| 882 |
+
"outputs": [],
|
| 883 |
+
"source": []
|
| 884 |
+
},
|
| 885 |
+
{
|
| 886 |
+
"cell_type": "code",
|
| 887 |
+
"execution_count": null,
|
| 888 |
+
"id": "7487267b",
|
| 889 |
+
"metadata": {},
|
| 890 |
+
"outputs": [],
|
| 891 |
+
"source": []
|
| 892 |
+
}
|
| 893 |
+
],
|
| 894 |
+
"metadata": {
|
| 895 |
+
"kernelspec": {
|
| 896 |
+
"display_name": "Python 3 (ipykernel)",
|
| 897 |
+
"language": "python",
|
| 898 |
+
"name": "python3"
|
| 899 |
+
},
|
| 900 |
+
"language_info": {
|
| 901 |
+
"codemirror_mode": {
|
| 902 |
+
"name": "ipython",
|
| 903 |
+
"version": 3
|
| 904 |
+
},
|
| 905 |
+
"file_extension": ".py",
|
| 906 |
+
"mimetype": "text/x-python",
|
| 907 |
+
"name": "python",
|
| 908 |
+
"nbconvert_exporter": "python",
|
| 909 |
+
"pygments_lexer": "ipython3",
|
| 910 |
+
"version": "3.10.10"
|
| 911 |
+
}
|
| 912 |
+
},
|
| 913 |
+
"nbformat": 4,
|
| 914 |
+
"nbformat_minor": 5
|
| 915 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
langchain
|
| 2 |
+
openai
|
| 3 |
+
chromadb
|
| 4 |
+
pypdf
|
| 5 |
+
tiktoken
|
| 6 |
+
panel
|
| 7 |
+
notebook
|