зеркало из
				https://github.com/ssciwr/AMMICO.git
				synced 2025-10-31 14:06:04 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			2044 строки
		
	
	
		
			52 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			2044 строки
		
	
	
		
			52 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {
 | |
|  "cells": [
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "# Image summary and visual question answering"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "This notebooks shows how to generate image captions and use the visual question answering with [LAVIS](https://github.com/salesforce/LAVIS). \n",
 | |
|     "\n",
 | |
|     "The first cell is only run on google colab and installs the [ammico](https://github.com/ssciwr/AMMICO) package.\n",
 | |
|     "\n",
 | |
|     "After that, we can import `ammico` and read in the files given a folder path."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 1,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:37:19.248809Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:37:19.248470Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:37:19.257477Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:37:19.256914Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "# if running on google colab\n",
 | |
|     "# flake8-noqa-cell\n",
 | |
|     "import os\n",
 | |
|     "\n",
 | |
|     "if \"google.colab\" in str(get_ipython()):\n",
 | |
|     "    # update python version\n",
 | |
|     "    # install setuptools\n",
 | |
|     "    # %pip install setuptools==61 -qqq\n",
 | |
|     "    # install ammico\n",
 | |
|     "    %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
 | |
|     "    # mount google drive for data and API key\n",
 | |
|     "    from google.colab import drive\n",
 | |
|     "\n",
 | |
|     "    drive.mount(\"/content/drive\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 2,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:37:19.260421Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:37:19.260014Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:37:29.773724Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:37:29.773092Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "import ammico\n",
 | |
|     "from ammico import utils as mutils\n",
 | |
|     "from ammico import display as mdisplay\n",
 | |
|     "import ammico.summary as sm"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 3,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:37:29.778185Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:37:29.776622Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:37:29.782912Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:37:29.782317Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "# Here you need to provide the path to your google drive folder\n",
 | |
|     "# or local folder containing the images\n",
 | |
|     "images = mutils.find_files(\n",
 | |
|     "    path=\"data/\",\n",
 | |
|     "    limit=10,\n",
 | |
|     ")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 4,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:37:29.785859Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:37:29.785428Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:37:29.789559Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:37:29.788992Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "mydict = mutils.initialize_dict(images)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Create captions for images and directly write to csv"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Here you can choose between two models: \"base\" or \"large\". This will generate the caption for each image and directly put the results in a dataframe. This dataframe can be exported as a csv file.\n",
 | |
|     "\n",
 | |
|     "The results are written into the columns `const_image_summary` - this will always be the same result (as always the same seed will be used). The column `3_non-deterministic_summary` displays three different answers generated with different seeds, these are most likely different when you run the analysis again."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 5,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:37:29.792451Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:37:29.791927Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:38:37.648735Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:38:37.641235Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 0.00/2.50G [00:00<?, ?B/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 8.01M/2.50G [00:00<00:42, 62.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 16.3M/2.50G [00:00<00:35, 75.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 32.0M/2.50G [00:00<00:28, 92.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 44.8M/2.50G [00:00<00:24, 106MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 55.1M/2.50G [00:00<00:26, 100MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 67.7M/2.50G [00:00<00:23, 110MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 80.0M/2.50G [00:00<00:24, 108MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  4%|▍         | 96.9M/2.50G [00:00<00:20, 128MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▍         | 117M/2.50G [00:01<00:16, 152MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▌         | 132M/2.50G [00:01<00:17, 147MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  6%|▌         | 152M/2.50G [00:01<00:15, 164MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 169M/2.50G [00:01<00:14, 169MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 186M/2.50G [00:01<00:15, 160MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  8%|▊         | 202M/2.50G [00:01<00:15, 164MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  9%|▊         | 224M/2.50G [00:01<00:15, 156MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|▉         | 246M/2.50G [00:01<00:13, 176MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|█         | 263M/2.50G [00:01<00:15, 153MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 11%|█         | 286M/2.50G [00:02<00:13, 173MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 12%|█▏        | 304M/2.50G [00:02<00:13, 174MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 13%|█▎        | 327M/2.50G [00:02<00:12, 192MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 14%|█▎        | 347M/2.50G [00:02<00:11, 196MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 14%|█▍        | 367M/2.50G [00:02<00:11, 201MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 15%|█▌        | 388M/2.50G [00:02<00:11, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 16%|█▌        | 408M/2.50G [00:02<00:11, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 17%|█▋        | 435M/2.50G [00:02<00:10, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 18%|█▊        | 456M/2.50G [00:02<00:10, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 19%|█▊        | 477M/2.50G [00:03<00:10, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 19%|█▉        | 497M/2.50G [00:03<00:11, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 20%|██        | 516M/2.50G [00:03<00:11, 188MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 21%|██        | 544M/2.50G [00:03<00:09, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 22%|██▏       | 565M/2.50G [00:03<00:10, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 23%|██▎       | 588M/2.50G [00:03<00:09, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 24%|██▍       | 614M/2.50G [00:03<00:08, 229MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 25%|██▍       | 636M/2.50G [00:03<00:09, 208MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 26%|██▌       | 656M/2.50G [00:03<00:09, 202MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 27%|██▋       | 680M/2.50G [00:04<00:09, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 28%|██▊       | 708M/2.50G [00:04<00:08, 238MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▊       | 732M/2.50G [00:04<00:08, 232MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▉       | 755M/2.50G [00:04<00:08, 236MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 30%|███       | 778M/2.50G [00:04<00:08, 230MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 31%|███▏      | 805M/2.50G [00:04<00:07, 246MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 32%|███▏      | 829M/2.50G [00:04<00:07, 238MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 33%|███▎      | 857M/2.50G [00:04<00:07, 254MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 34%|███▍      | 883M/2.50G [00:04<00:06, 259MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 36%|███▌      | 911M/2.50G [00:04<00:06, 271MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 37%|███▋      | 937M/2.50G [00:05<00:06, 259MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 966M/2.50G [00:05<00:06, 270MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 39%|███▊      | 992M/2.50G [00:05<00:06, 247MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 40%|███▉      | 1.00G/2.50G [00:05<00:06, 259MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 41%|████      | 1.02G/2.50G [00:05<00:05, 271MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 42%|████▏     | 1.05G/2.50G [00:05<00:05, 273MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 43%|████▎     | 1.08G/2.50G [00:05<00:06, 230MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▍     | 1.10G/2.50G [00:05<00:06, 247MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 45%|████▌     | 1.13G/2.50G [00:06<00:05, 256MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 46%|████▌     | 1.15G/2.50G [00:06<00:05, 250MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 47%|████▋     | 1.18G/2.50G [00:06<00:05, 262MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 48%|████▊     | 1.21G/2.50G [00:06<00:05, 259MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 49%|████▉     | 1.23G/2.50G [00:06<00:05, 246MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 50%|█████     | 1.26G/2.50G [00:06<00:05, 255MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 51%|█████     | 1.28G/2.50G [00:06<00:05, 260MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 52%|█████▏    | 1.31G/2.50G [00:07<00:10, 122MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 53%|█████▎    | 1.33G/2.50G [00:07<00:11, 110MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 55%|█████▍    | 1.37G/2.50G [00:07<00:08, 147MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 55%|█████▌    | 1.39G/2.50G [00:07<00:08, 145MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 56%|█████▋    | 1.41G/2.50G [00:07<00:08, 145MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 57%|█████▋    | 1.44G/2.50G [00:07<00:06, 169MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 58%|█████▊    | 1.46G/2.50G [00:08<00:05, 190MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 59%|█████▉    | 1.49G/2.50G [00:08<00:05, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 60%|██████    | 1.51G/2.50G [00:08<00:06, 167MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 61%|██████▏   | 1.54G/2.50G [00:08<00:05, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 62%|██████▏   | 1.56G/2.50G [00:08<00:05, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 63%|██████▎   | 1.58G/2.50G [00:08<00:05, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▍   | 1.60G/2.50G [00:08<00:04, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 65%|██████▍   | 1.63G/2.50G [00:08<00:04, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 66%|██████▌   | 1.65G/2.50G [00:09<00:04, 221MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 67%|██████▋   | 1.67G/2.50G [00:09<00:04, 182MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 68%|██████▊   | 1.70G/2.50G [00:09<00:04, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 69%|██████▊   | 1.72G/2.50G [00:09<00:03, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 70%|██████▉   | 1.74G/2.50G [00:09<00:03, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 70%|███████   | 1.76G/2.50G [00:09<00:04, 164MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 71%|███████▏  | 1.79G/2.50G [00:09<00:04, 165MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 1.81G/2.50G [00:10<00:03, 190MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 73%|███████▎  | 1.84G/2.50G [00:10<00:03, 198MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 74%|███████▍  | 1.86G/2.50G [00:10<00:06, 110MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 75%|███████▌  | 1.89G/2.50G [00:10<00:04, 145MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▌  | 1.91G/2.50G [00:10<00:04, 154MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 77%|███████▋  | 1.93G/2.50G [00:10<00:04, 148MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 78%|███████▊  | 1.95G/2.50G [00:11<00:03, 182MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 79%|███████▉  | 1.97G/2.50G [00:11<00:03, 175MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 80%|███████▉  | 2.00G/2.50G [00:11<00:02, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 81%|████████  | 2.03G/2.50G [00:11<00:02, 223MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 82%|████████▏ | 2.05G/2.50G [00:11<00:02, 181MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 83%|████████▎ | 2.08G/2.50G [00:11<00:02, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 84%|████████▍ | 2.10G/2.50G [00:11<00:02, 181MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 85%|████████▌ | 2.13G/2.50G [00:11<00:01, 207MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 86%|████████▌ | 2.15G/2.50G [00:12<00:02, 177MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 87%|████████▋ | 2.17G/2.50G [00:12<00:02, 130MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 88%|████████▊ | 2.20G/2.50G [00:12<00:02, 160MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 88%|████████▊ | 2.22G/2.50G [00:12<00:02, 152MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 89%|████████▉ | 2.24G/2.50G [00:12<00:01, 176MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|█████████ | 2.26G/2.50G [00:12<00:01, 182MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 91%|█████████ | 2.28G/2.50G [00:13<00:02, 113MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 2.30G/2.50G [00:13<00:01, 131MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 93%|█████████▎| 2.33G/2.50G [00:13<00:01, 166MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 94%|█████████▍| 2.36G/2.50G [00:13<00:00, 187MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 95%|█████████▌| 2.38G/2.50G [00:13<00:00, 202MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 96%|█████████▌| 2.40G/2.50G [00:15<00:02, 47.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 97%|█████████▋| 2.42G/2.50G [00:15<00:01, 52.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 97%|█████████▋| 2.43G/2.50G [00:15<00:01, 59.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 2.45G/2.50G [00:15<00:00, 70.8MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 2.46G/2.50G [00:15<00:00, 80.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 99%|█████████▉| 2.48G/2.50G [00:15<00:00, 91.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 99%|█████████▉| 2.49G/2.50G [00:15<00:00, 102MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|██████████| 2.50G/2.50G [00:15<00:00, 168MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\n"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 0.00/1.35G [00:00<?, ?B/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 4.01M/1.35G [00:00<00:55, 26.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 8.01M/1.35G [00:00<00:43, 32.9MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 24.0M/1.35G [00:00<00:20, 69.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 32.0M/1.35G [00:00<00:19, 72.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 45.7M/1.35G [00:00<00:14, 94.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  4%|▍         | 56.0M/1.35G [00:00<00:14, 93.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▌         | 75.5M/1.35G [00:00<00:10, 126MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 96.0M/1.35G [00:00<00:09, 149MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  8%|▊         | 112M/1.35G [00:01<00:08, 154MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|█         | 139M/1.35G [00:01<00:06, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 12%|█▏        | 165M/1.35G [00:01<00:05, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 14%|█▎        | 188M/1.35G [00:01<00:05, 222MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 15%|█▌        | 209M/1.35G [00:01<00:06, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 17%|█▋        | 237M/1.35G [00:01<00:05, 222MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 19%|█▉        | 262M/1.35G [00:01<00:05, 232MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 21%|██        | 289M/1.35G [00:01<00:04, 245MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 23%|██▎       | 313M/1.35G [00:02<00:06, 178MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 24%|██▍       | 332M/1.35G [00:02<00:06, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 26%|██▌       | 352M/1.35G [00:02<00:05, 188MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 27%|██▋       | 376M/1.35G [00:02<00:05, 206MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▉       | 397M/1.35G [00:02<00:04, 207MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 31%|███       | 421M/1.35G [00:02<00:04, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 32%|███▏      | 442M/1.35G [00:02<00:06, 145MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 34%|███▍      | 472M/1.35G [00:02<00:05, 178MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 36%|███▌      | 498M/1.35G [00:03<00:04, 201MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 521M/1.35G [00:03<00:04, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 39%|███▉      | 544M/1.35G [00:03<00:04, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 41%|████▏     | 572M/1.35G [00:03<00:03, 235MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▎     | 601M/1.35G [00:03<00:03, 254MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 46%|████▌     | 631M/1.35G [00:03<00:02, 270MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 48%|████▊     | 657M/1.35G [00:03<00:03, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 49%|████▉     | 682M/1.35G [00:03<00:03, 207MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 52%|█████▏    | 711M/1.35G [00:03<00:03, 230MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 53%|█████▎    | 736M/1.35G [00:04<00:02, 232MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 55%|█████▌    | 760M/1.35G [00:04<00:03, 209MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 57%|█████▋    | 784M/1.35G [00:04<00:02, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 59%|█████▉    | 812M/1.35G [00:04<00:02, 240MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 61%|██████    | 836M/1.35G [00:04<00:03, 151MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 62%|██████▏   | 860M/1.35G [00:04<00:03, 170MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▍   | 882M/1.35G [00:04<00:02, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 66%|██████▌   | 905M/1.35G [00:05<00:02, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 67%|██████▋   | 926M/1.35G [00:05<00:02, 164MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 69%|██████▉   | 953M/1.35G [00:05<00:02, 192MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 71%|███████   | 974M/1.35G [00:05<00:02, 161MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 998M/1.35G [00:05<00:02, 179MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 74%|███████▍  | 0.99G/1.35G [00:05<00:02, 174MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▌  | 1.02G/1.35G [00:05<00:01, 196MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 77%|███████▋  | 1.04G/1.35G [00:06<00:01, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 79%|███████▉  | 1.07G/1.35G [00:06<00:01, 226MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 81%|████████  | 1.09G/1.35G [00:06<00:01, 232MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 83%|████████▎ | 1.12G/1.35G [00:06<00:00, 248MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 85%|████████▍ | 1.14G/1.35G [00:06<00:00, 249MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 86%|████████▋ | 1.16G/1.35G [00:06<00:01, 157MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 88%|████████▊ | 1.19G/1.35G [00:06<00:00, 177MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|████████▉ | 1.21G/1.35G [00:06<00:00, 176MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 1.23G/1.35G [00:07<00:00, 189MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 93%|█████████▎| 1.25G/1.35G [00:07<00:00, 197MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 95%|█████████▍| 1.28G/1.35G [00:07<00:00, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 97%|█████████▋| 1.31G/1.35G [00:07<00:00, 239MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 99%|█████████▉| 1.33G/1.35G [00:07<00:00, 251MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|██████████| 1.35G/1.35G [00:07<00:00, 192MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\n"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "obj = sm.SummaryDetector(mydict)\n",
 | |
|     "summary_model, summary_vis_processors = obj.load_model(model_type=\"base\")\n",
 | |
|     "# summary_model, summary_vis_processors = mutils.load_model(\"large\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 6,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:38:37.702479Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:38:37.700969Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.189784Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.186250Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "ename": "TypeError",
 | |
|      "evalue": "analyse_image() got an unexpected keyword argument 'summary_model'",
 | |
|      "output_type": "error",
 | |
|      "traceback": [
 | |
|       "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
 | |
|       "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
 | |
|       "Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m mydict:\n\u001b[0;32m----> 2\u001b[0m     mydict[key] \u001b[38;5;241m=\u001b[39m \u001b[43msm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSummaryDetector\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmydict\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43manalyse_image\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m      3\u001b[0m \u001b[43m        \u001b[49m\u001b[43msummary_model\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msummary_model\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msummary_vis_processors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msummary_vis_processors\u001b[49m\n\u001b[1;32m      4\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n",
 | |
|       "\u001b[0;31mTypeError\u001b[0m: analyse_image() got an unexpected keyword argument 'summary_model'"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "for key in mydict:\n",
 | |
|     "    mydict[key] = sm.SummaryDetector(mydict[key]).analyse_image(\n",
 | |
|     "        summary_model=summary_model, summary_vis_processors=summary_vis_processors\n",
 | |
|     "    )"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {
 | |
|     "tags": []
 | |
|    },
 | |
|    "source": [
 | |
|     "Convert the dictionary of dictionarys into a dictionary with lists:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 7,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.310131Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.308636Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.436639Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.435997Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "outdict = mutils.append_data_to_dict(mydict)\n",
 | |
|     "df = mutils.dump_df(outdict)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Check the dataframe:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 8,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.446712Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.446078Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.590238Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.589231Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "data": {
 | |
|       "text/html": [
 | |
|        "<div>\n",
 | |
|        "<style scoped>\n",
 | |
|        "    .dataframe tbody tr th:only-of-type {\n",
 | |
|        "        vertical-align: middle;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe tbody tr th {\n",
 | |
|        "        vertical-align: top;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe thead th {\n",
 | |
|        "        text-align: right;\n",
 | |
|        "    }\n",
 | |
|        "</style>\n",
 | |
|        "<table border=\"1\" class=\"dataframe\">\n",
 | |
|        "  <thead>\n",
 | |
|        "    <tr style=\"text-align: right;\">\n",
 | |
|        "      <th></th>\n",
 | |
|        "      <th>filename</th>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </thead>\n",
 | |
|        "  <tbody>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>0</th>\n",
 | |
|        "      <td>102141_2_eng</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>1</th>\n",
 | |
|        "      <td>102730_eng</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>2</th>\n",
 | |
|        "      <td>106349S_por</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </tbody>\n",
 | |
|        "</table>\n",
 | |
|        "</div>"
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "       filename\n",
 | |
|        "0  102141_2_eng\n",
 | |
|        "1    102730_eng\n",
 | |
|        "2   106349S_por"
 | |
|       ]
 | |
|      },
 | |
|      "execution_count": 8,
 | |
|      "metadata": {},
 | |
|      "output_type": "execute_result"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "df.head(10)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Write the csv file:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 9,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.620825Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.620274Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.675192Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.674427Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "df.to_csv(\"data_out.csv\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Manually inspect the summaries\n",
 | |
|     "\n",
 | |
|     "To check the analysis, you can inspect the analyzed elements here. Loading the results takes a moment, so please be patient. If you are sure of what you are doing.\n",
 | |
|     "\n",
 | |
|     "`const_image_summary` - the permanent summarys, which does not change from run to run (analyse_image).\n",
 | |
|     "\n",
 | |
|     "`3_non-deterministic_summary` - 3 different summarys examples that change from run to run (analyse_image). "
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 10,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.682661Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.681750Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.715332Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.714643Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "ename": "TypeError",
 | |
|      "evalue": "__init__() got an unexpected keyword argument 'identify'",
 | |
|      "output_type": "error",
 | |
|      "traceback": [
 | |
|       "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
 | |
|       "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
 | |
|       "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m analysis_explorer \u001b[38;5;241m=\u001b[39m \u001b[43mmdisplay\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mAnalysisExplorer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmydict\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midentify\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43msummary\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m      2\u001b[0m analysis_explorer\u001b[38;5;241m.\u001b[39mrun_server(port\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m8055\u001b[39m)\n",
 | |
|       "\u001b[0;31mTypeError\u001b[0m: __init__() got an unexpected keyword argument 'identify'"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "analysis_explorer = mdisplay.AnalysisExplorer(mydict, identify=\"summary\")\n",
 | |
|     "analysis_explorer.run_server(port=8055)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Generate answers to free-form questions about images written in natural language. "
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Set the list of questions as a list of strings:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 11,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.731323Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.730891Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.734630Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.733961Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "list_of_questions = [\n",
 | |
|     "    \"How many persons on the picture?\",\n",
 | |
|     "    \"Are there any politicians in the picture?\",\n",
 | |
|     "    \"Does the picture show something from medicine?\",\n",
 | |
|     "]"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Explore the analysis using the interface:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 12,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.744289Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.743742Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:17.773216Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:17.772587Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "ename": "TypeError",
 | |
|      "evalue": "__init__() got an unexpected keyword argument 'identify'",
 | |
|      "output_type": "error",
 | |
|      "traceback": [
 | |
|       "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
 | |
|       "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
 | |
|       "Cell \u001b[0;32mIn[12], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m analysis_explorer \u001b[38;5;241m=\u001b[39m \u001b[43mmdisplay\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mAnalysisExplorer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmydict\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midentify\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43msummary\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m      2\u001b[0m analysis_explorer\u001b[38;5;241m.\u001b[39mrun_server(port\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m8055\u001b[39m)\n",
 | |
|       "\u001b[0;31mTypeError\u001b[0m: __init__() got an unexpected keyword argument 'identify'"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "analysis_explorer = mdisplay.AnalysisExplorer(mydict, identify=\"summary\")\n",
 | |
|     "analysis_explorer.run_server(port=8055)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Or directly analyze for further processing\n",
 | |
|     "Instead of inspecting each of the images, you can also directly carry out the analysis and export the result into a csv. This may take a while depending on how many images you have loaded."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 13,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:17.781865Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:17.781433Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:53.239520Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:53.238193Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "ename": "FileNotFoundError",
 | |
|      "evalue": "[Errno 2] No such file or directory: '102141_2_eng'",
 | |
|      "output_type": "error",
 | |
|      "traceback": [
 | |
|       "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
 | |
|       "\u001b[0;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)",
 | |
|       "Cell \u001b[0;32mIn[13], line 2\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m mydict:\n\u001b[0;32m----> 2\u001b[0m     mydict[key] \u001b[38;5;241m=\u001b[39m \u001b[43msm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSummaryDetector\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmydict\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43manalyse_questions\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlist_of_questions\u001b[49m\u001b[43m)\u001b[49m\n",
 | |
|       "File \u001b[0;32m~/work/AMMICO/AMMICO/ammico/summary.py:368\u001b[0m, in \u001b[0;36mSummaryDetector.analyse_questions\u001b[0;34m(self, list_of_questions, consequential_questions)\u001b[0m\n\u001b[1;32m    366\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(list_of_questions) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m    367\u001b[0m     path \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msubdict[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfilename\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m--> 368\u001b[0m     raw_image \u001b[38;5;241m=\u001b[39m \u001b[43mImage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mconvert(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRGB\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m    369\u001b[0m     image \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m    370\u001b[0m         vis_processors[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124meval\u001b[39m\u001b[38;5;124m\"\u001b[39m](raw_image)\u001b[38;5;241m.\u001b[39munsqueeze(\u001b[38;5;241m0\u001b[39m)\u001b[38;5;241m.\u001b[39mto(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msummary_device)\n\u001b[1;32m    371\u001b[0m     )\n\u001b[1;32m    372\u001b[0m     question_batch \u001b[38;5;241m=\u001b[39m []\n",
 | |
|       "File \u001b[0;32m/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/PIL/Image.py:3243\u001b[0m, in \u001b[0;36mopen\u001b[0;34m(fp, mode, formats)\u001b[0m\n\u001b[1;32m   3240\u001b[0m     filename \u001b[38;5;241m=\u001b[39m fp\n\u001b[1;32m   3242\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m filename:\n\u001b[0;32m-> 3243\u001b[0m     fp \u001b[38;5;241m=\u001b[39m \u001b[43mbuiltins\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrb\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m   3244\u001b[0m     exclusive_fp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m   3246\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
 | |
|       "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '102141_2_eng'"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "for key in mydict:\n",
 | |
|     "    mydict[key] = sm.SummaryDetector(mydict[key]).analyse_questions(list_of_questions)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Convert to dataframe and write csv\n",
 | |
|     "These steps are required to convert the dictionary of dictionarys into a dictionary with lists, that can be converted into a pandas dataframe and exported to a csv file."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 14,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:53.254397Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:53.253916Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:53.281013Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:53.280384Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "outdict2 = mutils.append_data_to_dict(mydict)\n",
 | |
|     "df2 = mutils.dump_df(outdict2)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 15,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:53.285645Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:53.285191Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:53.318873Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:53.318301Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "data": {
 | |
|       "text/html": [
 | |
|        "<div>\n",
 | |
|        "<style scoped>\n",
 | |
|        "    .dataframe tbody tr th:only-of-type {\n",
 | |
|        "        vertical-align: middle;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe tbody tr th {\n",
 | |
|        "        vertical-align: top;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe thead th {\n",
 | |
|        "        text-align: right;\n",
 | |
|        "    }\n",
 | |
|        "</style>\n",
 | |
|        "<table border=\"1\" class=\"dataframe\">\n",
 | |
|        "  <thead>\n",
 | |
|        "    <tr style=\"text-align: right;\">\n",
 | |
|        "      <th></th>\n",
 | |
|        "      <th>filename</th>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </thead>\n",
 | |
|        "  <tbody>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>0</th>\n",
 | |
|        "      <td>102141_2_eng</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>1</th>\n",
 | |
|        "      <td>102730_eng</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>2</th>\n",
 | |
|        "      <td>106349S_por</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </tbody>\n",
 | |
|        "</table>\n",
 | |
|        "</div>"
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "       filename\n",
 | |
|        "0  102141_2_eng\n",
 | |
|        "1    102730_eng\n",
 | |
|        "2   106349S_por"
 | |
|       ]
 | |
|      },
 | |
|      "execution_count": 15,
 | |
|      "metadata": {},
 | |
|      "output_type": "execute_result"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "df2.head(10)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 16,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-10-18T21:39:53.322709Z",
 | |
|      "iopub.status.busy": "2023-10-18T21:39:53.322053Z",
 | |
|      "iopub.status.idle": "2023-10-18T21:39:53.335776Z",
 | |
|      "shell.execute_reply": "2023-10-18T21:39:53.334627Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "df2.to_csv(\"data_out2.csv\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": []
 | |
|   }
 | |
|  ],
 | |
|  "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.9.18"
 | |
|   },
 | |
|   "vscode": {
 | |
|    "interpreter": {
 | |
|     "hash": "f1142466f556ab37fe2d38e2897a16796906208adb09fea90ba58bdf8a56f0ba"
 | |
|    }
 | |
|   }
 | |
|  },
 | |
|  "nbformat": 4,
 | |
|  "nbformat_minor": 4
 | |
| }
 | 
