Downloads images from Google search results based on a specified search query string, such as "cute kittens."
In order to keep the development process tidy, you should use a virtual environment when installing application-specific packages. There are multiple ways to set up virtual environments (e.g. using Pipenv), but the example below shows how you can do this using the native tools:
cd google_image_download
python3 -m venv .venvNOTE: Never commit your virtual environment to git, as this adds a lot of uneccesary files.
Then install requirements on your virtual environment:
source .venv/bin/activateThen run the following commands to install all requirements for local:
pip install -r requirements.txt
To deactivate the virtual environment you just need to run the following commands:
deactivateFor formatting our code we use black and isort packages.
The package can be build and installed with symlinks by doing the following:
cd google_iamge_download
pip install -e .
python setup.py sdist --formats=gztarBefore running the project create a PostgreSQL database on your local with a table name google_images and with a column name file_path. Because we are running this query in the program:
INSERT INTO public.google_images(file_path) VALUES ($1);To create and run docker for this project run the following commands:
docker build -t google_img .
docker run -it google_imgThis will run the program and ask you about the local PostgreSQL info. Then connect to that db, save image path to the db but the save the file on a folder in the container.