Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# OCR Fuel Reimbursements from 2016"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import os\n",
"import base64\n",
"import concurrent.futures\n",
"import configparser\n",
"import glob\n",
"import json\n",
"\n",
"from urllib.request import urlretrieve, Request, urlopen\n",
"\n",
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"from serenata_toolbox.datasets import fetch\n",
"\n",
"fetch(\"2016-12-06-reimbursements.xz\", \"../data\")\n",
"reimbursements = pd.read_csv('../data/2016-12-06-reimbursements.xz', low_memory=False).query('year >= 2016')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"65455"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = reimbursements.query('subquota_description == \"Fuels and lubricants\"')\n",
"len(df)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Code that can be incorporated into serenata toolbox"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ign http://cdn-fastly.deb.debian.org jessie InRelease\n",
"Hit http://cdn-fastly.deb.debian.org jessie/updates InRelease\n",
"Hit http://ppa.launchpad.net trusty InRelease\n",
"Hit http://cdn-fastly.deb.debian.org jessie Release.gpg\n",
"Hit http://cdn-fastly.deb.debian.org jessie Release\n",
"Get:1 http://cdn-fastly.deb.debian.org jessie/updates/main amd64 Packages [437 kB]\n",
"Get:2 http://ppa.launchpad.net trusty/main amd64 Packages [8,303 B]\n",
"Get:3 http://cdn-fastly.deb.debian.org jessie/main amd64 Packages [9,049 kB]\n",
"Fetched 9,494 kB in 5s (1,828 kB/s)\n",
"Reading package lists...\n",
"Reading package lists...\n",
"Building dependency tree...\n",
"Reading state information...\n",
"poppler-utils is already the newest version.\n",
"0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.\n"
]
}
],
"source": [
"%%bash\n",
"sudo apt-get update && sudo apt-get install -y poppler-utils"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Based on https://github.com/GoogleCloudPlatform/cloud-vision/blob/e07f7415d551d43c2507e82c1f2cc19d31dabd08/python/text/textindex.py#L67\n",
"class VisionApi:\n",
" \"\"\"Construct and use the Google Vision API service.\"\"\"\n",
"\n",
" def __init__(self, key):\n",
" self.endpoint = \"https://vision.clients6.google.com/v1/images:annotate?key={}\".format(key)\n",
"\n",
" def detect_text(self, input_filenames, num_retries=3):\n",
" \"\"\"Uses the Vision API to detect text in the given file.\n",
" \"\"\"\n",
" \n",
" images = {}\n",
" for filename in input_filenames:\n",
" with open(filename, 'rb') as image_file:\n",
" images[filename] = image_file.read()\n",
"\n",
" batch_request = []\n",
" for filename in images:\n",
" batch_request.append({\n",
" 'image': { 'content': base64.b64encode(images[filename]).decode('UTF-8') },\n",
" 'features': [{ 'type': 'TEXT_DETECTION' }]\n",
" })\n",
" params = json.dumps({'requests': batch_request}).encode('utf8')\n",
" req = Request(self.endpoint, data=params, headers={'content-type': 'application/json'})\n",
" response = urlopen(req)\n",
" responses = json.loads(response.read().decode('utf8'))\n",
" \n",
" if 'responses' not in responses:\n",
" print(\"No responses\")\n",
" text_response = {}\n",
" for filename, response in zip(images, responses['responses']):\n",
" if 'error' in response:\n",
" print(\"API Error for %s: %s\" % (\n",
" filename,\n",
" response['error']['message']\n",
" if 'message' in response['error']\n",
" else ''))\n",
" continue\n",
" if 'textAnnotations' in response:\n",
" text_response[filename] = response['textAnnotations']\n",
" else:\n",
" text_response[filename] = []\n",
" return text_response\n",
"\n",
"class ReimbursementsOCR:\n",
" DOCUMENT_URL = (\n",
" 'http://www.camara.gov.br/'\n",
" 'cota-parlamentar/documentos/publ/{}/{}/{}.pdf'\n",
" )\n",
"\n",
" def __init__(self, receipts_path, imgs_root, vision_api):\n",
" self.receipts_path = receipts_path\n",
" self.imgs_root = imgs_root\n",
" self.vision_api = vision_api\n",
"\n",
" def process(self, applicant_id, year, document_id):\n",
" receipt_path = self.__download_receipt(applicant_id, year, document_id)\n",
" receipt_imgs_prefix = self.__generate_imgs(receipt_path, document_id)\n",
" return self.__ocr(receipt_imgs_prefix)\n",
"\n",
" def __download_receipt(self, applicant_id, year, document_id):\n",
" receipt_path = \"{}/{}.pdf\".format(self.receipts_path, document_id)\n",
" if not os.path.exists(receipt_path):\n",
" url = self.DOCUMENT_URL.format(applicant_id, year, document_id)\n",
" urlretrieve(url, receipt_path)\n",
" return receipt_path\n",
"\n",
" def __generate_imgs(self, receipt_path, document_id):\n",
" receipt_imgs_prefix = \"{}/{}\".format(self.imgs_root, document_id)\n",
" if os.path.exists(\"{}-1.png\".format(receipt_imgs_prefix)):\n",
" return receipt_imgs_prefix\n",
"\n",
" excode = os.system(\"pdftoppm -rx 300 -ry 300 -png {} {}\".format(receipt_path, receipt_imgs_prefix))\n",
" if excode != 0:\n",
" raise RuntimeError('Image generation failed')\n",
"\n",
" return receipt_imgs_prefix\n",
"\n",
" def __ocr(self, receipt_imgs_prefix):\n",
" pages = glob.glob(\"{}-*.png\".format(receipt_imgs_prefix))\n",
" reimbursement_text = {}\n",
" \n",
" pages_ocred = self.vision_api.detect_text(pages)\n",
" for page_file in pages_ocred:\n",
" doc_id_and_page = os.path.splitext(os.path.basename(page_file))[0]\n",
" _, page = doc_id_and_page.split('-')\n",
" reimbursement_text[page] = pages_ocred[page_file]\n",
" return reimbursement_text\n",
"\n",
"def ocr_reimbursement(idx_and_reimbursement):\n",
" reimbursement = idx_and_reimbursement[1]\n",
" applicant_id = reimbursement.applicant_id\n",
" year = reimbursement.year\n",
" document_id = reimbursement.document_id\n",
"\n",
" dest = \"../data/receipts-ocr/{}.json\".format(document_id)\n",
" if os.path.exists(dest):\n",
" return (document_id, True)\n",
"\n",
" try:\n",
" resp = ocr.process(applicant_id, year, document_id)\n",
" target = open(dest, 'w')\n",
" target.write(json.dumps(resp))\n",
" target.close()\n",
" except Exception as exc:\n",
" print('%r generated an exception: %s' % (document_id, exc))\n",
" return (document_id, False)\n",
" else:\n",
" return (document_id, True)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"settings = configparser.RawConfigParser()\n",
"settings.read('../config.ini')\n",
"google_api_key = settings.get('Google', 'APIKey')\n",
"\n",
"if not os.path.exists(\"../data/receipts-pdfs\"):\n",
" os.makedirs(\"../data/receipts-pdfs\")\n",
"if not os.path.exists(\"../data/receipts-imgs\"):\n",
" os.makedirs(\"../data/receipts-imgs\")\n",
"if not os.path.exists(\"../data/receipts-ocr\"):\n",
" os.makedirs(\"../data/receipts-ocr\")\n",
" \n",
"vision_api = VisionApi(google_api_key)\n",
"ocr = ReimbursementsOCR('../data/receipts-pdfs', '../data/receipts-imgs', vision_api)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6116900 generated an exception: HTTP Error 400: Bad Request\n",
"At 1000\n",
"5890700 generated an exception: HTTP Error 400: Bad Request\n",
"6053986 generated an exception: HTTP Error 400: Bad Request\n",
"6054048 generated an exception: HTTP Error 400: Bad Request\n",
"6053989 generated an exception: HTTP Error 400: Bad Request\n",
"6053992 generated an exception: HTTP Error 400: Bad Request\n",
"6053994 generated an exception: HTTP Error 400: Bad Request\n",
"5940844 generated an exception: HTTP Error 404: Not Found\n",
"5940851 generated an exception: HTTP Error 404: Not Found\n",
"6006383 generated an exception: HTTP Error 404: Not Found\n",
"6056640 generated an exception: HTTP Error 400: Bad Request\n",
"6056779 generated an exception: HTTP Error 400: Bad Request\n",
"6056654 generated an exception: HTTP Error 400: Bad Request\n",
"6056646 generated an exception: HTTP Error 400: Bad Request\n",
"6059422 generated an exception: HTTP Error 400: Bad Request\n",
"6059469 generated an exception: HTTP Error 400: Bad Request\n",
"6059431 generated an exception: HTTP Error 400: Bad Request\n",
"6056649 generated an exception: HTTP Error 400: Bad Request\n",
"6059477 generated an exception: HTTP Error 400: Bad Request\n",
"At 2000\n",
"5904286 generated an exception: HTTP Error 400: Bad Request\n",
"5891513 generated an exception: HTTP Error 400: Bad Request\n",
"5930121 generated an exception: HTTP Error 400: Bad Request\n",
"5961372 generated an exception: HTTP Error 400: Bad Request\n",
"6043896 generated an exception: HTTP Error 400: Bad Request\n",
"5988851 generated an exception: HTTP Error 400: Bad Request\n",
"6014558 generated an exception: HTTP Error 400: Bad Request\n",
"6095047 generated an exception: HTTP Error 400: Bad Request\n",
"6138167 generated an exception: HTTP Error 400: Bad Request\n",
"6059363 generated an exception: HTTP Error 400: Bad Request\n",
"6118332 generated an exception: HTTP Error 400: Bad Request\n",
"At 3000\n",
"At 4000\n",
"5948914 generated an exception: HTTP Error 400: Bad Request\n",
"5974646 generated an exception: HTTP Error 400: Bad Request\n",
"5966698 generated an exception: HTTP Error 400: Bad Request\n",
"5990518 generated an exception: HTTP Error 400: Bad Request\n",
"6068856 generated an exception: HTTP Error 400: Bad Request\n",
"6091302 generated an exception: HTTP Error 400: Bad Request\n",
"At 5000\n",
"5927512 generated an exception: HTTP Error 400: Bad Request\n",
"At 6000\n",
"At 7000\n",
"At 8000\n",
"5933460 generated an exception: HTTP Error 400: Bad Request\n",
"6078932 generated an exception: HTTP Error 404: Not Found\n",
"6100372 generated an exception: HTTP Error 404: Not Found\n",
"6109541 generated an exception: HTTP Error 400: Bad Request\n",
"6021496 generated an exception: HTTP Error 400: Bad Request\n",
"6066825 generated an exception: HTTP Error 400: Bad Request\n",
"6137663 generated an exception: HTTP Error 400: Bad Request\n",
"At 9000\n",
"6106609 generated an exception: HTTP Error 400: Bad Request\n",
"6106605 generated an exception: HTTP Error 400: Bad Request\n",
"6108044 generated an exception: HTTP Error 400: Bad Request\n",
"6108075 generated an exception: HTTP Error 400: Bad Request\n",
"At 10000\n",
"6095809 generated an exception: HTTP Error 400: Bad Request\n",
"6117370 generated an exception: HTTP Error 400: Bad Request\n",
"5891885 generated an exception: HTTP Error 400: Bad Request\n",
"5974002 generated an exception: HTTP Error 400: Bad Request\n",
"5975999 generated an exception: HTTP Error 400: Bad Request\n",
"5988947 generated an exception: HTTP Error 400: Bad Request\n",
"6036660 generated an exception: HTTP Error 400: Bad Request\n",
"6057988 generated an exception: HTTP Error 400: Bad Request\n",
"6100298 generated an exception: HTTP Error 400: Bad Request\n",
"At 11000\n",
"API Error for ../data/receipts-imgs/6042094-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6042088-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6042093-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6042097-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6042279-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6042159-1.png: image-annotator::Bad image data.: Image processing error!\n",
"6054556 generated an exception: Image generation failed\n",
"6054548 generated an exception: Image generation failed\n",
"API Error for ../data/receipts-imgs/6054539-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054561-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059329-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054546-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054545-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054553-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054549-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054564-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054566-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054573-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059322-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6054567-1.png: image-annotator::Bad image data.: Image processing error!\n",
"6068973 generated an exception: Image generation failed\n",
"API Error for ../data/receipts-imgs/6059333-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059335-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059342-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059376-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059354-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6059367-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069957-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069602-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069078-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069000-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069068-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069072-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069595-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069082-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069606-1.png: image-annotator::Bad image data.: Image processing error!\n",
"6070018 generated an exception: Image generation failed\n",
"API Error for ../data/receipts-imgs/6069961-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069965-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069968-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069990-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069973-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069983-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6069988-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070009-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070107-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070243-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070022-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070237-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070019-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070225-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070229-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6070573-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075767-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075766-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075769-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075798-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075794-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075793-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6075770-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092291-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092357-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092300-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092361-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092378-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092382-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6096350-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6096384-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6092390-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6096344-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6096392-1.png: image-annotator::Bad image data.: Image processing error!\n",
"API Error for ../data/receipts-imgs/6096388-1.png: image-annotator::Bad image data.: Image processing error!\n",
"At 12000\n",
"5944916 generated an exception: HTTP Error 400: Bad Request\n",
"At 13000\n",
"5951921 generated an exception: HTTP Error 400: Bad Request\n",
"At 14000\n",
"6040679 generated an exception: HTTP Error 400: Bad Request\n",
"5889466 generated an exception: HTTP Error 400: Bad Request\n",
"5960001 generated an exception: HTTP Error 400: Bad Request\n",
"5927645 generated an exception: HTTP Error 400: Bad Request\n",
"5983770 generated an exception: HTTP Error 400: Bad Request\n",
"6015939 generated an exception: HTTP Error 400: Bad Request\n",
"6067667 generated an exception: HTTP Error 400: Bad Request\n",
"6096896 generated an exception: HTTP Error 400: Bad Request\n",
"6128540 generated an exception: HTTP Error 400: Bad Request\n",
"At 15000\n",
"5965472 generated an exception: HTTP Error 400: Bad Request\n",
"At 16000\n",
"At 17000\n",
"6042481 generated an exception: HTTP Error 404: Not Found\n",
"At 18000\n",
"6045528 generated an exception: HTTP Error 400: Bad Request\n",
"5897704 generated an exception: HTTP Error 404: Not Found\n",
"5911705 generated an exception: HTTP Error 404: Not Found\n",
"5911721 generated an exception: HTTP Error 404: Not Found\n",
"5918826 generated an exception: HTTP Error 404: Not Found\n",
"5947730 generated an exception: HTTP Error 404: Not Found\n",
"At 19000\n",
"5926850 generated an exception: HTTP Error 400: Bad Request\n",
"6028421 generated an exception: HTTP Error 400: Bad Request\n",
"6040275 generated an exception: HTTP Error 400: Bad Request\n",
"6105234 generated an exception: HTTP Error 400: Bad Request\n",
"6124839 generated an exception: HTTP Error 400: Bad Request\n",
"6136801 generated an exception: HTTP Error 400: Bad Request\n",
"At 20000\n",
"5905846 generated an exception: HTTP Error 400: Bad Request\n",
"6143964 generated an exception: HTTP Error 400: Bad Request\n",
"At 21000\n",
"6135894 generated an exception: HTTP Error 400: Bad Request\n",
"At 22000\n",
"5972291 generated an exception: HTTP Error 404: Not Found\n",
"6026053 generated an exception: HTTP Error 404: Not Found\n",
"6026059 generated an exception: HTTP Error 404: Not Found\n",
"6103532 generated an exception: HTTP Error 404: Not Found\n",
"6127026 generated an exception: HTTP Error 404: Not Found\n",
"6127033 generated an exception: HTTP Error 404: Not Found\n",
"6133056 generated an exception: HTTP Error 404: Not Found\n",
"6072689 generated an exception: HTTP Error 400: Bad Request\n",
"At 23000\n",
"At 24000\n",
"At 25000\n",
"At 26000\n",
"6088381 generated an exception: HTTP Error 400: Bad Request\n",
"At 27000\n",
"5915229 generated an exception: HTTP Error 404: Not Found\n",
"5915239 generated an exception: HTTP Error 404: Not Found\n",
"5948298 generated an exception: HTTP Error 404: Not Found\n",
"5948302 generated an exception: HTTP Error 404: Not Found\n",
"5980013 generated an exception: HTTP Error 404: Not Found\n",
"6016691 generated an exception: HTTP Error 404: Not Found\n",
"6051185 generated an exception: HTTP Error 404: Not Found\n",
"6064683 generated an exception: HTTP Error 404: Not Found\n",
"6070451 generated an exception: HTTP Error 404: Not Found\n",
"6082900 generated an exception: HTTP Error 400: Bad Request\n",
"6082899 generated an exception: HTTP Error 400: Bad Request\n",
"6088162 generated an exception: HTTP Error 400: Bad Request\n",
"6082902 generated an exception: HTTP Error 400: Bad Request\n",
"6129564 generated an exception: HTTP Error 400: Bad Request\n",
"At 28000\n",
"6074460 generated an exception: HTTP Error 400: Bad Request\n",
"6121066 generated an exception: HTTP Error 400: Bad Request\n",
"6101874 generated an exception: HTTP Error 400: Bad Request\n",
"6148199 generated an exception: HTTP Error 400: Bad Request\n",
"6055858 generated an exception: HTTP Error 400: Bad Request\n",
"At 29000\n",
"6064016 generated an exception: HTTP Error 400: Bad Request\n",
"6064017 generated an exception: HTTP Error 400: Bad Request\n",
"6064023 generated an exception: HTTP Error 400: Bad Request\n",
"At 30000\n",
"At 31000\n",
"At 32000\n",
"6115845 generated an exception: HTTP Error 400: Bad Request\n",
"6142051 generated an exception: HTTP Error 400: Bad Request\n",
"5906730 generated an exception: HTTP Error 400: Bad Request\n",
"5946725 generated an exception: HTTP Error 400: Bad Request\n",
"5975844 generated an exception: HTTP Error 400: Bad Request\n",
"At 33000\n",
"5893212 generated an exception: HTTP Error 400: Bad Request\n",
"5893215 generated an exception: HTTP Error 400: Bad Request\n",
"5893213 generated an exception: HTTP Error 400: Bad Request\n",
"5894720 generated an exception: HTTP Error 400: Bad Request\n",
"5893214 generated an exception: HTTP Error 400: Bad Request\n",
"5897881 generated an exception: HTTP Error 400: Bad Request\n",
"5894721 generated an exception: HTTP Error 400: Bad Request\n",
"5900094 generated an exception: HTTP Error 400: Bad Request\n",
"5897879 generated an exception: HTTP Error 400: Bad Request\n",
"5900090 generated an exception: HTTP Error 400: Bad Request\n",
"5898450 generated an exception: HTTP Error 400: Bad Request\n",
"5897098 generated an exception: HTTP Error 400: Bad Request\n",
"5900005 generated an exception: HTTP Error 400: Bad Request\n",
"5906762 generated an exception: HTTP Error 400: Bad Request\n",
"5906805 generated an exception: HTTP Error 400: Bad Request\n",
"5906795 generated an exception: HTTP Error 400: Bad Request\n",
"5907998 generated an exception: HTTP Error 400: Bad Request\n",
"5907996 generated an exception: HTTP Error 400: Bad Request\n",
"5900118 generated an exception: HTTP Error 400: Bad Request\n",
"5907994 generated an exception: HTTP Error 400: Bad Request\n",
"5920066 generated an exception: HTTP Error 400: Bad Request\n",
"5920083 generated an exception: HTTP Error 400: Bad Request\n",
"5920113 generated an exception: HTTP Error 400: Bad Request\n",
"5920815 generated an exception: HTTP Error 400: Bad Request\n",
"5920092 generated an exception: HTTP Error 400: Bad Request\n",
"5922277 generated an exception: HTTP Error 400: Bad Request\n",
"5940996 generated an exception: HTTP Error 400: Bad Request\n",
"5938750 generated an exception: HTTP Error 400: Bad Request\n",
"5941038 generated an exception: HTTP Error 400: Bad Request\n",
"5963855 generated an exception: HTTP Error 400: Bad Request\n",
"At 34000\n",
"6148395 generated an exception: HTTP Error 400: Bad Request\n",
"At 35000\n",
"6071249 generated an exception: HTTP Error 400: Bad Request\n",
"6113770 generated an exception: HTTP Error 404: Not Found\n",
"At 36000\n",
"5997604 generated an exception: HTTP Error 403: Forbidden\n",
"5997609 generated an exception: HTTP Error 403: Forbidden\n",
"6001171 generated an exception: HTTP Error 403: Forbidden\n",
"5997615 generated an exception: HTTP Error 403: Forbidden\n",
"6005574 generated an exception: HTTP Error 403: Forbidden\n",
"6002925 generated an exception: HTTP Error 403: Forbidden\n",
"6002918 generated an exception: HTTP Error 403: Forbidden\n",
"6007809 generated an exception: HTTP Error 403: Forbidden\n",
"6007695 generated an exception: HTTP Error 403: Forbidden\n",
"6007700 generated an exception: HTTP Error 403: Forbidden\n",
"6007817 generated an exception: HTTP Error 403: Forbidden\n",
"6002932 generated an exception: HTTP Error 403: Forbidden\n",
"6007816 generated an exception: HTTP Error 403: Forbidden\n",
"6007697 generated an exception: HTTP Error 403: Forbidden\n",
"6007827 generated an exception: HTTP Error 403: Forbidden\n",
"6007823 generated an exception: HTTP Error 403: Forbidden\n",
"6015697 generated an exception: HTTP Error 403: Forbidden\n",
"6015701 generated an exception: HTTP Error 403: Forbidden\n",
"6015712 generated an exception: HTTP Error 403: Forbidden\n",
"6007830 generated an exception: HTTP Error 403: Forbidden\n",
"6015707 generated an exception: HTTP Error 403: Forbidden\n",
"6015716 generated an exception: HTTP Error 403: Forbidden\n",
"6015821 generated an exception: HTTP Error 403: Forbidden\n",
"6022033 generated an exception: HTTP Error 403: Forbidden\n",
"6015722 generated an exception: HTTP Error 403: Forbidden\n",
"6015826 generated an exception: HTTP Error 403: Forbidden\n",
"6015817 generated an exception: HTTP Error 403: Forbidden\n",
"6022028 generated an exception: HTTP Error 403: Forbidden\n",
"6007812 generated an exception: HTTP Error 403: Forbidden\n",
"6015828 generated an exception: HTTP Error 403: Forbidden\n",
"6022036 generated an exception: HTTP Error 403: Forbidden\n",
"6022074 generated an exception: HTTP Error 403: Forbidden\n",
"6032985 generated an exception: HTTP Error 403: Forbidden\n",
"6032982 generated an exception: HTTP Error 403: Forbidden\n",
"6032980 generated an exception: HTTP Error 403: Forbidden\n",
"6032990 generated an exception: HTTP Error 403: Forbidden\n",
"6033014 generated an exception: HTTP Error 403: Forbidden\n",
"6033004 generated an exception: HTTP Error 403: Forbidden\n",
"6032992 generated an exception: HTTP Error 403: Forbidden\n",
"6032995 generated an exception: HTTP Error 403: Forbidden\n",
"6033008 generated an exception: HTTP Error 403: Forbidden\n",
"6033041 generated an exception: HTTP Error 403: Forbidden\n",
"6022034 generated an exception: HTTP Error 403: Forbidden\n",
"6033020 generated an exception: HTTP Error 403: Forbidden\n",
"6039859 generated an exception: HTTP Error 403: Forbidden\n",
"6033044 generated an exception: HTTP Error 403: Forbidden\n",
"6033049 generated an exception: HTTP Error 403: Forbidden\n",
"6033028 generated an exception: HTTP Error 403: Forbidden\n",
"6039854 generated an exception: HTTP Error 403: Forbidden\n",
"6039879 generated an exception: HTTP Error 403: Forbidden\n",
"6039869 generated an exception: HTTP Error 403: Forbidden\n",
"6033057 generated an exception: HTTP Error 403: Forbidden\n",
"6039890 generated an exception: HTTP Error 403: Forbidden\n",
"6039884 generated an exception: HTTP Error 403: Forbidden\n",
"6048523 generated an exception: HTTP Error 403: Forbidden\n",
"6048516 generated an exception: HTTP Error 403: Forbidden\n",
"6048521 generated an exception: HTTP Error 403: Forbidden\n",
"6048531 generated an exception: HTTP Error 403: Forbidden\n",
"6048488 generated an exception: HTTP Error 403: Forbidden\n",
"6048535 generated an exception: HTTP Error 403: Forbidden\n",
"6055817 generated an exception: HTTP Error 403: Forbidden\n",
"6048546 generated an exception: HTTP Error 403: Forbidden\n",
"6048484 generated an exception: HTTP Error 403: Forbidden\n",
"6048540 generated an exception: HTTP Error 403: Forbidden\n",
"6050119 generated an exception: HTTP Error 403: Forbidden\n",
"6055820 generated an exception: HTTP Error 403: Forbidden\n",
"6048579 generated an exception: HTTP Error 403: Forbidden\n",
"6055829 generated an exception: HTTP Error 403: Forbidden\n",
"6060331 generated an exception: HTTP Error 403: Forbidden\n",
"6055831 generated an exception: HTTP Error 403: Forbidden\n",
"6061357 generated an exception: HTTP Error 403: Forbidden\n",
"6060962 generated an exception: HTTP Error 403: Forbidden\n",
"6061363 generated an exception: HTTP Error 403: Forbidden\n",
"6060970 generated an exception: HTTP Error 403: Forbidden\n",
"6060967 generated an exception: HTTP Error 403: Forbidden\n",
"6061388 generated an exception: HTTP Error 403: Forbidden\n",
"6061370 generated an exception: HTTP Error 403: Forbidden\n",
"6061400 generated an exception: HTTP Error 403: Forbidden\n",
"6061397 generated an exception: HTTP Error 403: Forbidden\n",
"6061372 generated an exception: HTTP Error 403: Forbidden\n",
"6060959 generated an exception: HTTP Error 403: Forbidden\n",
"6061382 generated an exception: HTTP Error 403: Forbidden\n",
"6061415 generated an exception: HTTP Error 403: Forbidden\n",
"6061410 generated an exception: HTTP Error 403: Forbidden\n",
"5902487 generated an exception: HTTP Error 403: Forbidden\n",
"5902466 generated an exception: HTTP Error 403: Forbidden\n",
"5902534 generated an exception: HTTP Error 403: Forbidden\n",
"5937015 generated an exception: HTTP Error 400: Bad Request\n",
"5997691 generated an exception: HTTP Error 400: Bad Request\n",
"At 37000\n",
"6017161 generated an exception: HTTP Error 400: Bad Request\n",
"5984350 generated an exception: HTTP Error 400: Bad Request\n",
"At 38000\n",
"5910574 generated an exception: HTTP Error 400: Bad Request\n",
"5972577 generated an exception: HTTP Error 400: Bad Request\n",
"5982076 generated an exception: HTTP Error 400: Bad Request\n",
"At 39000\n",
"6153123 generated an exception: HTTP Error 400: Bad Request\n",
"At 40000\n",
"5890964 generated an exception: HTTP Error 400: Bad Request\n",
"5904944 generated an exception: HTTP Error 400: Bad Request\n",
"At 41000\n",
"5904914 generated an exception: HTTP Error 400: Bad Request\n",
"5919902 generated an exception: HTTP Error 400: Bad Request\n",
"5978695 generated an exception: HTTP Error 400: Bad Request\n",
"6004549 generated an exception: HTTP Error 400: Bad Request\n",
"6004548 generated an exception: HTTP Error 400: Bad Request\n",
"6004543 generated an exception: HTTP Error 400: Bad Request\n",
"6004545 generated an exception: HTTP Error 400: Bad Request\n",
"6118526 generated an exception: HTTP Error 400: Bad Request\n",
"6118537 generated an exception: HTTP Error 400: Bad Request\n",
"6118532 generated an exception: HTTP Error 400: Bad Request\n",
"At 42000\n",
"At 43000\n",
"At 44000\n",
"At 45000\n",
"6124228 generated an exception: HTTP Error 400: Bad Request\n",
"6136296 generated an exception: HTTP Error 400: Bad Request\n",
"5891621 generated an exception: HTTP Error 400: Bad Request\n",
"At 46000\n",
"6054286 generated an exception: HTTP Error 404: Not Found\n",
"6054304 generated an exception: HTTP Error 404: Not Found\n",
"6022782 generated an exception: HTTP Error 404: Not Found\n",
"6022795 generated an exception: HTTP Error 404: Not Found\n",
"6022805 generated an exception: HTTP Error 404: Not Found\n",
"6022813 generated an exception: HTTP Error 404: Not Found\n",
"6022816 generated an exception: HTTP Error 404: Not Found\n",
"6090542 generated an exception: Image generation failed\n",
"5905922 generated an exception: HTTP Error 400: Bad Request\n",
"At 47000\n",
"6042247 generated an exception: HTTP Error 400: Bad Request\n",
"6046832 generated an exception: HTTP Error 400: Bad Request\n",
"6061932 generated an exception: HTTP Error 400: Bad Request\n",
"6095172 generated an exception: HTTP Error 400: Bad Request\n",
"6093938 generated an exception: HTTP Error 400: Bad Request\n",
"At 48000\n",
"6026556 generated an exception: HTTP Error 400: Bad Request\n",
"6137244 generated an exception: HTTP Error 400: Bad Request\n",
"6137247 generated an exception: HTTP Error 400: Bad Request\n",
"At 49000\n",
"At 50000\n",
"At 51000\n",
"At 52000\n",
"5905583 generated an exception: HTTP Error 400: Bad Request\n",
"5927300 generated an exception: HTTP Error 400: Bad Request\n",
"6011771 generated an exception: HTTP Error 400: Bad Request\n",
"6039612 generated an exception: HTTP Error 400: Bad Request\n",
"At 53000\n",
"6081474 generated an exception: HTTP Error 404: Not Found\n",
"6081483 generated an exception: HTTP Error 404: Not Found\n",
"6081495 generated an exception: HTTP Error 404: Not Found\n",
"At 54000\n",
"5907716 generated an exception: HTTP Error 400: Bad Request\n",
"5890203 generated an exception: HTTP Error 400: Bad Request\n",
"5900658 generated an exception: HTTP Error 400: Bad Request\n",
"5900655 generated an exception: HTTP Error 400: Bad Request\n",
"5900661 generated an exception: HTTP Error 400: Bad Request\n",
"5900694 generated an exception: HTTP Error 400: Bad Request\n",
"5912224 generated an exception: HTTP Error 400: Bad Request\n",
"5900649 generated an exception: HTTP Error 400: Bad Request\n",
"5900696 generated an exception: HTTP Error 400: Bad Request\n",
"5912393 generated an exception: HTTP Error 400: Bad Request\n",
"5912402 generated an exception: HTTP Error 400: Bad Request\n",
"5912458 generated an exception: HTTP Error 400: Bad Request\n",
"5912425 generated an exception: HTTP Error 400: Bad Request\n",
"5912416 generated an exception: HTTP Error 400: Bad Request\n",
"5912434 generated an exception: HTTP Error 400: Bad Request\n",
"5912467 generated an exception: HTTP Error 400: Bad Request\n",
"5912454 generated an exception: HTTP Error 400: Bad Request\n",
"5912486 generated an exception: HTTP Error 400: Bad Request\n",
"5912474 generated an exception: HTTP Error 400: Bad Request\n",
"5912491 generated an exception: HTTP Error 400: Bad Request\n",
"5912480 generated an exception: HTTP Error 400: Bad Request\n",
"5912512 generated an exception: HTTP Error 400: Bad Request\n",
"5912521 generated an exception: HTTP Error 400: Bad Request\n",
"5912903 generated an exception: HTTP Error 400: Bad Request\n",
"5912913 generated an exception: HTTP Error 400: Bad Request\n",
"5912910 generated an exception: HTTP Error 400: Bad Request\n",
"5912907 generated an exception: HTTP Error 400: Bad Request\n",
"5912938 generated an exception: HTTP Error 400: Bad Request\n",
"5912933 generated an exception: HTTP Error 400: Bad Request\n",
"5918827 generated an exception: HTTP Error 400: Bad Request\n",
"5918845 generated an exception: HTTP Error 400: Bad Request\n",
"5918835 generated an exception: HTTP Error 400: Bad Request\n",
"5918856 generated an exception: HTTP Error 400: Bad Request\n",
"5918861 generated an exception: HTTP Error 400: Bad Request\n",
"5918867 generated an exception: HTTP Error 400: Bad Request\n",
"5918872 generated an exception: HTTP Error 400: Bad Request\n",
"5976344 generated an exception: HTTP Error 400: Bad Request\n",
"5961230 generated an exception: HTTP Error 400: Bad Request\n",
"5961227 generated an exception: HTTP Error 400: Bad Request\n",
"5976362 generated an exception: HTTP Error 400: Bad Request\n",
"5961199 generated an exception: HTTP Error 400: Bad Request\n",
"5961204 generated an exception: HTTP Error 400: Bad Request\n",
"5976378 generated an exception: HTTP Error 400: Bad Request\n",
"5961234 generated an exception: HTTP Error 400: Bad Request\n",
"5976419 generated an exception: HTTP Error 400: Bad Request\n",
"5961209 generated an exception: HTTP Error 400: Bad Request\n",
"5976383 generated an exception: HTTP Error 400: Bad Request\n",
"5976370 generated an exception: HTTP Error 400: Bad Request\n",
"5976427 generated an exception: HTTP Error 400: Bad Request\n",
"5976444 generated an exception: HTTP Error 400: Bad Request\n",
"5976499 generated an exception: HTTP Error 400: Bad Request\n",
"5976465 generated an exception: HTTP Error 400: Bad Request\n",
"5976898 generated an exception: HTTP Error 400: Bad Request\n",
"5976488 generated an exception: HTTP Error 400: Bad Request\n",
"5976905 generated an exception: HTTP Error 400: Bad Request\n",
"5976904 generated an exception: HTTP Error 400: Bad Request\n",
"5976907 generated an exception: HTTP Error 400: Bad Request\n",
"5984439 generated an exception: HTTP Error 400: Bad Request\n",
"5984448 generated an exception: HTTP Error 400: Bad Request\n",
"5984564 generated an exception: HTTP Error 400: Bad Request\n",
"5984569 generated an exception: HTTP Error 400: Bad Request\n",
"6008961 generated an exception: HTTP Error 400: Bad Request\n",
"6008966 generated an exception: HTTP Error 400: Bad Request\n",
"6008995 generated an exception: HTTP Error 400: Bad Request\n",
"6008972 generated an exception: HTTP Error 400: Bad Request\n",
"6008949 generated an exception: HTTP Error 400: Bad Request\n",
"6008985 generated an exception: HTTP Error 400: Bad Request\n",
"6010352 generated an exception: HTTP Error 400: Bad Request\n",
"6008956 generated an exception: HTTP Error 400: Bad Request\n",
"6008978 generated an exception: HTTP Error 400: Bad Request\n",
"6009059 generated an exception: HTTP Error 400: Bad Request\n",
"6010387 generated an exception: HTTP Error 400: Bad Request\n",
"6010382 generated an exception: HTTP Error 400: Bad Request\n",
"6010375 generated an exception: HTTP Error 400: Bad Request\n",
"6013058 generated an exception: HTTP Error 400: Bad Request\n",
"6015925 generated an exception: HTTP Error 400: Bad Request\n",
"6023290 generated an exception: HTTP Error 400: Bad Request\n",
"6018405 generated an exception: HTTP Error 400: Bad Request\n",
"6018416 generated an exception: HTTP Error 400: Bad Request\n",
"6023674 generated an exception: HTTP Error 400: Bad Request\n",
"6015938 generated an exception: HTTP Error 400: Bad Request\n",
"6023292 generated an exception: HTTP Error 400: Bad Request\n",
"6028722 generated an exception: HTTP Error 400: Bad Request\n",
"6015943 generated an exception: HTTP Error 400: Bad Request\n",
"6023294 generated an exception: HTTP Error 400: Bad Request\n",
"6028688 generated an exception: HTTP Error 400: Bad Request\n",
"6018407 generated an exception: HTTP Error 400: Bad Request\n",
"6018429 generated an exception: HTTP Error 400: Bad Request\n",
"6028726 generated an exception: HTTP Error 400: Bad Request\n",
"6028703 generated an exception: HTTP Error 400: Bad Request\n",
"6028729 generated an exception: HTTP Error 400: Bad Request\n",
"6039398 generated an exception: HTTP Error 400: Bad Request\n",
"6039402 generated an exception: HTTP Error 400: Bad Request\n",
"6039630 generated an exception: HTTP Error 400: Bad Request\n",
"6039660 generated an exception: HTTP Error 400: Bad Request\n",
"6039771 generated an exception: HTTP Error 400: Bad Request\n",
"6039637 generated an exception: HTTP Error 400: Bad Request\n",
"6066051 generated an exception: HTTP Error 400: Bad Request\n",
"6066054 generated an exception: HTTP Error 400: Bad Request\n",
"6069675 generated an exception: HTTP Error 400: Bad Request\n",
"6069758 generated an exception: HTTP Error 400: Bad Request\n",
"6066061 generated an exception: HTTP Error 400: Bad Request\n",
"6066069 generated an exception: HTTP Error 400: Bad Request\n",
"6066056 generated an exception: HTTP Error 400: Bad Request\n",
"6069671 generated an exception: HTTP Error 400: Bad Request\n",
"6069756 generated an exception: HTTP Error 400: Bad Request\n",
"6069764 generated an exception: HTTP Error 400: Bad Request\n",
"6066065 generated an exception: HTTP Error 400: Bad Request\n",
"6069768 generated an exception: HTTP Error 400: Bad Request\n",
"6080895 generated an exception: HTTP Error 400: Bad Request\n",
"6080889 generated an exception: HTTP Error 400: Bad Request\n",
"6080880 generated an exception: HTTP Error 400: Bad Request\n",
"6080887 generated an exception: HTTP Error 400: Bad Request\n",
"6081722 generated an exception: HTTP Error 400: Bad Request\n",
"At 55000\n",
"5958835 generated an exception: HTTP Error 400: Bad Request\n",
"5985235 generated an exception: HTTP Error 400: Bad Request\n",
"6014468 generated an exception: HTTP Error 400: Bad Request\n",
"6067999 generated an exception: HTTP Error 400: Bad Request\n",
"6110892 generated an exception: HTTP Error 400: Bad Request\n",
"6089567 generated an exception: HTTP Error 400: Bad Request\n",
"6086338 generated an exception: HTTP Error 400: Bad Request\n",
"6086343 generated an exception: HTTP Error 400: Bad Request\n",
"6155278 generated an exception: HTTP Error 400: Bad Request\n",
"At 56000\n",
"5967314 generated an exception: HTTP Error 400: Bad Request\n",
"6024289 generated an exception: HTTP Error 400: Bad Request\n",
"6143262 generated an exception: HTTP Error 400: Bad Request\n",
"6150319 generated an exception: HTTP Error 404: Not Found\n",
"6150323 generated an exception: HTTP Error 404: Not Found\n",
"At 57000\n",
"At 58000\n",
"6029604 generated an exception: HTTP Error 404: Not Found\n",
"At 59000\n",
"5907286 generated an exception: HTTP Error 400: Bad Request\n",
"6042004 generated an exception: HTTP Error 404: Not Found\n",
"6105092 generated an exception: HTTP Error 400: Bad Request\n",
"6105108 generated an exception: HTTP Error 400: Bad Request\n",
"6105105 generated an exception: HTTP Error 400: Bad Request\n",
"6105109 generated an exception: HTTP Error 400: Bad Request\n",
"6105113 generated an exception: HTTP Error 400: Bad Request\n",
"6105095 generated an exception: HTTP Error 400: Bad Request\n",
"6105354 generated an exception: HTTP Error 400: Bad Request\n",
"6063007 generated an exception: HTTP Error 400: Bad Request\n",
"6105247 generated an exception: HTTP Error 400: Bad Request\n",
"6113440 generated an exception: HTTP Error 400: Bad Request\n",
"6139194 generated an exception: HTTP Error 400: Bad Request\n",
"6132024 generated an exception: HTTP Error 400: Bad Request\n",
"At 60000\n",
"6048042 generated an exception: HTTP Error 400: Bad Request\n",
"5941319 generated an exception: HTTP Error 400: Bad Request\n",
"6026094 generated an exception: HTTP Error 400: Bad Request\n",
"6048679 generated an exception: HTTP Error 400: Bad Request\n",
"At 61000\n",
"5916603 generated an exception: HTTP Error 400: Bad Request\n",
"5916594 generated an exception: HTTP Error 400: Bad Request\n",
"5916606 generated an exception: HTTP Error 400: Bad Request\n",
"5916597 generated an exception: HTTP Error 400: Bad Request\n",
"5890421 generated an exception: HTTP Error 400: Bad Request\n",
"6083735 generated an exception: HTTP Error 400: Bad Request\n",
"6035333 generated an exception: HTTP Error 404: Not Found\n",
"6056432 generated an exception: HTTP Error 404: Not Found\n",
"6056476 generated an exception: HTTP Error 404: Not Found\n",
"At 62000\n",
"6070486 generated an exception: HTTP Error 400: Bad Request\n",
"6075515 generated an exception: HTTP Error 400: Bad Request\n",
"6126935 generated an exception: HTTP Error 400: Bad Request\n",
"6126943 generated an exception: HTTP Error 400: Bad Request\n",
"6126950 generated an exception: HTTP Error 400: Bad Request\n",
"6109932 generated an exception: HTTP Error 400: Bad Request\n",
"6121582 generated an exception: HTTP Error 400: Bad Request\n",
"6145077 generated an exception: HTTP Error 400: Bad Request\n",
"At 63000\n",
"6136870 generated an exception: HTTP Error 404: Not Found\n",
"5903015 generated an exception: HTTP Error 400: Bad Request\n",
"5890275 generated an exception: HTTP Error 400: Bad Request\n",
"At 64000\n",
"5890313 generated an exception: HTTP Error 400: Bad Request\n",
"5908167 generated an exception: HTTP Error 400: Bad Request\n",
"5959041 generated an exception: HTTP Error 400: Bad Request\n",
"5959042 generated an exception: HTTP Error 400: Bad Request\n",
"5959043 generated an exception: HTTP Error 400: Bad Request\n",
"At 65000\n",
"6154193 generated an exception: HTTP Error 400: Bad Request\n",
"6096574 generated an exception: HTTP Error 400: Bad Request\n",
"CPU times: user 1min 45s, sys: 9.39 s, total: 1min 54s\n",
"Wall time: 8h 31min 12s\n"
]
}
],
"source": [
"%%time\n",
"with concurrent.futures.ProcessPoolExecutor(16) as executor:\n",
" i = 0\n",
" for result in executor.map(ocr_reimbursement, df.iterrows()):\n",
" i += 1\n",
" if i % 1000 == 0:\n",
" print(\"At\", i)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"PDFs downloaded 65409\n",
"Imgs generated 80573\n",
"Receipts OCRed 64989\n"
]
}
],
"source": [
"%%bash\n",
"\n",
"echo \"PDFs downloaded $(ls ../data/receipts-pdfs | wc -l)\"\n",
"echo \"Imgs generated $(ls ../data/receipts-imgs | wc -l)\"\n",
"echo \"Receipts OCRed $(ls ../data/receipts-ocr | wc -l)\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.