зеркало из
				https://github.com/ssciwr/AMMICO.git
				synced 2025-10-31 22:16:05 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			2116 строки
		
	
	
		
			51 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			2116 строки
		
	
	
		
			51 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-06-27T07:34:03.421602Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:34:03.420722Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:34:03.431487Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:34:03.430247Z"
 | |
|     }
 | |
|    },
 | |
|    "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-06-27T07:34:03.434664Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:34:03.434229Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:34:14.649927Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:34:14.649225Z"
 | |
|     },
 | |
|     "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-06-27T07:34:14.653533Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:34:14.652734Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:34:14.657008Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:34:14.656335Z"
 | |
|     },
 | |
|     "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-06-27T07:34:14.660018Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:34:14.659575Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:34:14.662936Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:34:14.662252Z"
 | |
|     },
 | |
|     "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-06-27T07:34:14.666577Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:34:14.666138Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:35:20.595475Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:35:20.583828Z"
 | |
|     },
 | |
|     "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%|          | 4.72M/2.50G [00:00<00:54, 49.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 16.0M/2.50G [00:00<00:37, 71.8MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 24.0M/2.50G [00:00<00:49, 54.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 40.0M/2.50G [00:00<00:35, 74.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 48.0M/2.50G [00:00<00:35, 75.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 58.8M/2.50G [00:00<00:30, 85.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 69.8M/2.50G [00:00<00:27, 93.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 80.0M/2.50G [00:01<00:28, 90.0MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 88.9M/2.50G [00:01<00:29, 88.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  4%|▍         | 107M/2.50G [00:01<00:22, 115MB/s]  "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▍         | 121M/2.50G [00:01<00:20, 124MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▌         | 133M/2.50G [00:01<00:24, 104MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  6%|▌         | 146M/2.50G [00:01<00:22, 112MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  6%|▋         | 161M/2.50G [00:01<00:20, 125MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 176M/2.50G [00:01<00:18, 134MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  8%|▊         | 193M/2.50G [00:01<00:17, 145MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  8%|▊         | 210M/2.50G [00:02<00:15, 156MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  9%|▉         | 226M/2.50G [00:02<00:16, 153MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  9%|▉         | 242M/2.50G [00:02<00:15, 159MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|█         | 258M/2.50G [00:02<00:15, 159MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 11%|█         | 281M/2.50G [00:02<00:12, 184MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 12%|█▏        | 302M/2.50G [00:02<00:12, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 13%|█▎        | 321M/2.50G [00:02<00:12, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 13%|█▎        | 339M/2.50G [00:02<00:13, 176MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 14%|█▍        | 367M/2.50G [00:02<00:11, 209MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 15%|█▌        | 388M/2.50G [00:02<00:10, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 16%|█▌        | 408M/2.50G [00:03<00:12, 184MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 17%|█▋        | 432M/2.50G [00:03<00:11, 189MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 18%|█▊        | 457M/2.50G [00:03<00:10, 207MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 19%|█▊        | 477M/2.50G [00:03<00:10, 203MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 19%|█▉        | 497M/2.50G [00:03<00:11, 190MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 20%|██        | 516M/2.50G [00:03<00:14, 152MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 21%|██        | 543M/2.50G [00:03<00:11, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 22%|██▏       | 562M/2.50G [00:04<00:12, 174MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 23%|██▎       | 584M/2.50G [00:04<00:12, 166MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 23%|██▎       | 601M/2.50G [00:04<00:12, 165MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 25%|██▍       | 629M/2.50G [00:04<00:10, 198MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 25%|██▌       | 653M/2.50G [00:04<00:09, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 26%|██▋       | 675M/2.50G [00:04<00:09, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 27%|██▋       | 696M/2.50G [00:04<00:09, 209MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 28%|██▊       | 716M/2.50G [00:04<00:10, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▊       | 735M/2.50G [00:04<00:11, 170MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 30%|██▉       | 760M/2.50G [00:05<00:09, 193MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 30%|███       | 779M/2.50G [00:05<00:10, 180MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 31%|███       | 797M/2.50G [00:05<00:10, 176MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 32%|███▏      | 819M/2.50G [00:05<00:09, 189MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 33%|███▎      | 844M/2.50G [00:05<00:08, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 34%|███▍      | 872M/2.50G [00:05<00:07, 234MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 35%|███▍      | 895M/2.50G [00:05<00:07, 235MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 36%|███▌      | 920M/2.50G [00:05<00:08, 198MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 37%|███▋      | 946M/2.50G [00:06<00:07, 216MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 968M/2.50G [00:06<00:09, 175MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 39%|███▊      | 991M/2.50G [00:06<00:08, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 40%|███▉      | 0.99G/2.50G [00:06<00:07, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 40%|████      | 1.01G/2.50G [00:06<00:07, 204MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 42%|████▏     | 1.04G/2.50G [00:06<00:06, 226MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 42%|████▏     | 1.06G/2.50G [00:06<00:07, 200MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▎     | 1.09G/2.50G [00:06<00:06, 224MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 45%|████▍     | 1.12G/2.50G [00:06<00:06, 246MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 46%|████▌     | 1.15G/2.50G [00:07<00:05, 257MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 47%|████▋     | 1.17G/2.50G [00:07<00:05, 263MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 48%|████▊     | 1.20G/2.50G [00:07<00:05, 268MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 49%|████▉     | 1.23G/2.50G [00:07<00:04, 276MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 50%|████▉     | 1.25G/2.50G [00:07<00:05, 251MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 51%|█████     | 1.28G/2.50G [00:07<00:05, 244MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 52%|█████▏    | 1.30G/2.50G [00:07<00:04, 260MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 53%|█████▎    | 1.33G/2.50G [00:07<00:04, 253MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 54%|█████▍    | 1.35G/2.50G [00:07<00:05, 235MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 55%|█████▌    | 1.38G/2.50G [00:08<00:04, 250MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 56%|█████▌    | 1.40G/2.50G [00:08<00:06, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 57%|█████▋    | 1.42G/2.50G [00:08<00:06, 189MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 58%|█████▊    | 1.45G/2.50G [00:08<00:06, 169MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 58%|█████▊    | 1.46G/2.50G [00:08<00:06, 161MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 60%|█████▉    | 1.49G/2.50G [00:08<00:05, 193MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 60%|██████    | 1.51G/2.50G [00:08<00:06, 171MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 61%|██████    | 1.53G/2.50G [00:09<00:05, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 62%|██████▏   | 1.56G/2.50G [00:09<00:04, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 63%|██████▎   | 1.58G/2.50G [00:09<00:04, 202MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▍   | 1.60G/2.50G [00:09<00:04, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 65%|██████▍   | 1.63G/2.50G [00:09<00:04, 222MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 66%|██████▌   | 1.65G/2.50G [00:09<00:04, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 67%|██████▋   | 1.68G/2.50G [00:09<00:03, 236MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 68%|██████▊   | 1.70G/2.50G [00:09<00:03, 233MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 69%|██████▉   | 1.72G/2.50G [00:09<00:03, 225MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 70%|██████▉   | 1.74G/2.50G [00:10<00:03, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 71%|███████   | 1.77G/2.50G [00:10<00:03, 223MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 71%|███████▏  | 1.79G/2.50G [00:10<00:03, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 1.81G/2.50G [00:10<00:03, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 73%|███████▎  | 1.83G/2.50G [00:10<00:03, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 74%|███████▍  | 1.85G/2.50G [00:10<00:04, 156MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 75%|███████▌  | 1.88G/2.50G [00:10<00:03, 175MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▋  | 1.91G/2.50G [00:11<00:03, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 77%|███████▋  | 1.94G/2.50G [00:11<00:02, 226MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 79%|███████▊  | 1.97G/2.50G [00:11<00:02, 243MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 80%|███████▉  | 1.99G/2.50G [00:11<00:02, 249MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 80%|████████  | 2.01G/2.50G [00:11<00:02, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 82%|████████▏ | 2.04G/2.50G [00:11<00:02, 208MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 83%|████████▎ | 2.07G/2.50G [00:11<00:02, 225MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 84%|████████▎ | 2.09G/2.50G [00:11<00:02, 206MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 84%|████████▍ | 2.11G/2.50G [00:12<00:02, 200MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 85%|████████▌ | 2.13G/2.50G [00:12<00:02, 151MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 86%|████████▌ | 2.15G/2.50G [00:12<00:02, 152MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 87%|████████▋ | 2.17G/2.50G [00:12<00:02, 174MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 88%|████████▊ | 2.20G/2.50G [00:12<00:01, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 89%|████████▊ | 2.22G/2.50G [00:12<00:01, 166MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 89%|████████▉ | 2.24G/2.50G [00:14<00:09, 29.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|████████▉ | 2.25G/2.50G [00:15<00:07, 34.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|█████████ | 2.26G/2.50G [00:15<00:06, 39.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 91%|█████████ | 2.27G/2.50G [00:15<00:05, 46.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 91%|█████████ | 2.28G/2.50G [00:15<00:04, 52.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 2.30G/2.50G [00:15<00:03, 63.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 2.31G/2.50G [00:15<00:02, 76.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 93%|█████████▎| 2.32G/2.50G [00:15<00:02, 75.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 93%|█████████▎| 2.34G/2.50G [00:15<00:01, 98.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 94%|█████████▍| 2.36G/2.50G [00:16<00:01, 119MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 95%|█████████▌| 2.38G/2.50G [00:16<00:00, 142MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 96%|█████████▌| 2.40G/2.50G [00:16<00:00, 143MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 96%|█████████▋| 2.41G/2.50G [00:16<00:00, 145MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 97%|█████████▋| 2.43G/2.50G [00:16<00:00, 148MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 2.45G/2.50G [00:16<00:00, 172MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 99%|█████████▉| 2.48G/2.50G [00:16<00:00, 193MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|█████████▉| 2.50G/2.50G [00:16<00:00, 203MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|██████████| 2.50G/2.50G [00:16<00:00, 160MB/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:44, 32.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 15.0M/1.35G [00:00<00:18, 75.8MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 24.0M/1.35G [00:00<00:31, 44.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 36.6M/1.35G [00:00<00:21, 66.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 48.0M/1.35G [00:00<00:18, 75.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▍         | 63.1M/1.35G [00:00<00:14, 96.7MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  6%|▌         | 83.6M/1.35G [00:00<00:10, 129MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  8%|▊         | 107M/1.35G [00:01<00:08, 162MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|▉         | 132M/1.35G [00:01<00:06, 190MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 11%|█▏        | 158M/1.35G [00:01<00:06, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 13%|█▎        | 183M/1.35G [00:01<00:05, 229MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 15%|█▌        | 209M/1.35G [00:01<00:05, 242MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 17%|█▋        | 233M/1.35G [00:01<00:08, 143MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 18%|█▊        | 252M/1.35G [00:02<00:09, 123MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 20%|██        | 276M/1.35G [00:02<00:07, 148MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 22%|██▏       | 302M/1.35G [00:02<00:06, 173MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 24%|██▍       | 333M/1.35G [00:02<00:05, 209MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 26%|██▋       | 362M/1.35G [00:02<00:04, 232MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▊       | 394M/1.35G [00:02<00:04, 258MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 31%|███       | 424M/1.35G [00:02<00:03, 267MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 33%|███▎      | 452M/1.35G [00:02<00:05, 171MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 35%|███▍      | 478M/1.35G [00:03<00:04, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 37%|███▋      | 504M/1.35G [00:03<00:04, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 528M/1.35G [00:03<00:04, 204MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 40%|████      | 556M/1.35G [00:03<00:03, 225MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 42%|████▏     | 579M/1.35G [00:03<00:07, 109MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▍     | 605M/1.35G [00:04<00:06, 133MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 45%|████▌     | 626M/1.35G [00:04<00:09, 84.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 46%|████▋     | 641M/1.35G [00:04<00:09, 82.9MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 47%|████▋     | 654M/1.35G [00:04<00:09, 76.1MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 50%|████▉     | 684M/1.35G [00:05<00:06, 109MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 51%|█████     | 704M/1.35G [00:05<00:05, 125MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 52%|█████▏    | 721M/1.35G [00:05<00:05, 122MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 54%|█████▍    | 747M/1.35G [00:05<00:04, 150MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 56%|█████▌    | 768M/1.35G [00:05<00:04, 150MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 57%|█████▋    | 785M/1.35G [00:05<00:04, 136MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 58%|█████▊    | 800M/1.35G [00:05<00:05, 112MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 60%|█████▉    | 824M/1.35G [00:06<00:04, 134MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 62%|██████▏   | 850M/1.35G [00:06<00:03, 162MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 63%|██████▎   | 868M/1.35G [00:06<00:03, 155MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▍   | 884M/1.35G [00:06<00:03, 157MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 65%|██████▌   | 900M/1.35G [00:06<00:04, 112MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 68%|██████▊   | 931M/1.35G [00:06<00:03, 155MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 70%|██████▉   | 963M/1.35G [00:06<00:02, 193MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 994M/1.35G [00:07<00:01, 225MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 74%|███████▍  | 1.00G/1.35G [00:07<00:01, 226MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▋  | 1.03G/1.35G [00:07<00:01, 252MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 79%|███████▊  | 1.06G/1.35G [00:07<00:01, 272MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 81%|████████  | 1.09G/1.35G [00:07<00:00, 285MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 83%|████████▎ | 1.12G/1.35G [00:07<00:00, 279MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 85%|████████▍ | 1.14G/1.35G [00:07<00:00, 274MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 87%|████████▋ | 1.17G/1.35G [00:08<00:01, 168MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 88%|████████▊ | 1.19G/1.35G [00:08<00:01, 163MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|█████████ | 1.22G/1.35G [00:08<00:00, 184MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 1.24G/1.35G [00:08<00:00, 203MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 94%|█████████▍| 1.27G/1.35G [00:08<00:00, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 96%|█████████▌| 1.29G/1.35G [00:08<00:00, 118MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 1.32G/1.35G [00:09<00:00, 147MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|█████████▉| 1.34G/1.35G [00:09<00:00, 172MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|██████████| 1.35G/1.35G [00:09<00:00, 158MB/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-06-27T07:35:20.714623Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:35:20.711987Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.536992Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.535824Z"
 | |
|     },
 | |
|     "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-06-27T07:36:01.622130Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.621477Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.699370Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.698646Z"
 | |
|     },
 | |
|     "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-06-27T07:36:01.705804Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.705067Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.826465Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.825593Z"
 | |
|     },
 | |
|     "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>data/106349S_por.png</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>1</th>\n",
 | |
|        "      <td>data/102141_2_eng.png</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>2</th>\n",
 | |
|        "      <td>data/102730_eng.png</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </tbody>\n",
 | |
|        "</table>\n",
 | |
|        "</div>"
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "                filename\n",
 | |
|        "0   data/106349S_por.png\n",
 | |
|        "1  data/102141_2_eng.png\n",
 | |
|        "2    data/102730_eng.png"
 | |
|       ]
 | |
|      },
 | |
|      "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-06-27T07:36:01.840794Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.840269Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.882591Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.881826Z"
 | |
|     }
 | |
|    },
 | |
|    "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-06-27T07:36:01.890620Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.889777Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.930378Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.929566Z"
 | |
|     },
 | |
|     "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-06-27T07:36:01.938254Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.937829Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.941225Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.940634Z"
 | |
|     }
 | |
|    },
 | |
|    "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-06-27T07:36:01.946421Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.945814Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:36:01.983468Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:36:01.982504Z"
 | |
|     }
 | |
|    },
 | |
|    "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-06-27T07:36:01.988528Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:36:01.988142Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:37:53.205725Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:37:53.189652Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "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-06-27T07:37:53.312450Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:37:53.309423Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:37:53.381447Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:37:53.380670Z"
 | |
|     }
 | |
|    },
 | |
|    "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-06-27T07:37:53.387599Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:37:53.387346Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:37:53.465658Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:37:53.464807Z"
 | |
|     }
 | |
|    },
 | |
|    "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",
 | |
|        "      <th>How many persons on the picture?</th>\n",
 | |
|        "      <th>Are there any politicians in the picture?</th>\n",
 | |
|        "      <th>Does the picture show something from medicine?</th>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </thead>\n",
 | |
|        "  <tbody>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>0</th>\n",
 | |
|        "      <td>data/106349S_por.png</td>\n",
 | |
|        "      <td>1</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>1</th>\n",
 | |
|        "      <td>data/102141_2_eng.png</td>\n",
 | |
|        "      <td>1</td>\n",
 | |
|        "      <td>no</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>2</th>\n",
 | |
|        "      <td>data/102730_eng.png</td>\n",
 | |
|        "      <td>2</td>\n",
 | |
|        "      <td>no</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </tbody>\n",
 | |
|        "</table>\n",
 | |
|        "</div>"
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "                filename How many persons on the picture?  \\\n",
 | |
|        "0   data/106349S_por.png                                1   \n",
 | |
|        "1  data/102141_2_eng.png                                1   \n",
 | |
|        "2    data/102730_eng.png                                2   \n",
 | |
|        "\n",
 | |
|        "  Are there any politicians in the picture?  \\\n",
 | |
|        "0                                       yes   \n",
 | |
|        "1                                        no   \n",
 | |
|        "2                                        no   \n",
 | |
|        "\n",
 | |
|        "  Does the picture show something from medicine?  \n",
 | |
|        "0                                            yes  \n",
 | |
|        "1                                            yes  \n",
 | |
|        "2                                            yes  "
 | |
|       ]
 | |
|      },
 | |
|      "execution_count": 15,
 | |
|      "metadata": {},
 | |
|      "output_type": "execute_result"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "df2.head(10)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 16,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-27T07:37:53.489195Z",
 | |
|      "iopub.status.busy": "2023-06-27T07:37:53.488569Z",
 | |
|      "iopub.status.idle": "2023-06-27T07:37:53.502358Z",
 | |
|      "shell.execute_reply": "2023-06-27T07:37:53.501705Z"
 | |
|     }
 | |
|    },
 | |
|    "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.17"
 | |
|   },
 | |
|   "vscode": {
 | |
|    "interpreter": {
 | |
|     "hash": "f1142466f556ab37fe2d38e2897a16796906208adb09fea90ba58bdf8a56f0ba"
 | |
|    }
 | |
|   }
 | |
|  },
 | |
|  "nbformat": 4,
 | |
|  "nbformat_minor": 4
 | |
| }
 | 
