{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os; os.chdir('..')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# os.mkdir(\"ai_gen_images\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['https://cdn.discordapp.com/attachments/988028621421686834/988592559897059378/ac325c7f-b984-454a-bb62-e41dcd3fd5b6_StevenMertens_Bill_Sienkiewicz_technology__Jack_Kirby_machines__retro_futuristic_ghibli_matte_painting.png',\n", " 'https://cdn.discordapp.com/attachments/986263515713110056/988592330741252166/2735cb78-3bbe-419a-905c-c5e91dbed653_Erkan_Cerit_None.png',\n", " 'https://cdn.discordapp.com/attachments/988028621421686834/988592225803993118/a278dac1-035b-47e3-a4b2-f168ec626b51_StevenMertens_Bill_Sienkiewicz_technology__Jack_Kirby_machines__retro_futuristic_ghibli_matte_painting.png',\n", " 'https://cdn.discordapp.com/attachments/988028621421686834/988592214944907274/86e8ee74-05a3-48ce-9895-0be954752673_StevenMertens_Bill_Sienkiewicz_technology__Jack_Kirby_machines__retro_futuristic_ghibli_matte_painting.png',\n", " 'https://cdn.discordapp.com/attachments/982990243621908480/988592166035140608/f191002c-0f09-4139-a38e-64beba3e7084_MissTwistedRose_cats_with_many_eyes_floating_in_colorful_glowing_swirling_whisps_occult_inspired_emerging_from_the_v.png']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import json\n", "\n", "urls= json.load(open(\"research/urls.json\"))\n", "urls[:5]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "250133" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(urls)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " 2%|▏ | 5243/250133 [19:09<15:23:18, 4.42it/s]" ] } ], "source": [ "from tqdm import tqdm\n", "import requests\n", "i=0\n", "\n", "\n", "for url in tqdm(urls):\n", " filename= f\"ai_gen_images/image_{i}.png\"\n", " i+=1\n", " try:\n", " response= requests.get(url)\n", " if response.ok:\n", " with open(filename, \"wb\") as f:\n", " f.write(response.content)\n", " else:\n", " print(\"response not ok: \", url)\n", "\n", " except:\n", " print(url)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "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.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }