Skip to content

Image Downloader is a lightweight Python script that allows you to download images from the internet based on your search queries.

License

Notifications You must be signed in to change notification settings

Goer17/image-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Downloader

Image Downloader is a lightweight Python script that allows you to download images from the internet based on your search queries.

Additionally, to meet custom requirements, I have integrated the OpenAI SDK into this project, allowing you to use their API to filter images based on your specifications.

Installation

git clone https://github.com/Goer17/image-downloader.git
pip install -e .

Quick Start

from image_downloader.layer.download import GoogleURLCrawler
from image_downloader.layer.llm import Critic

from image_downloader.pipeline import Pipeline

pipeline = Pipeline(
    crawlers=[GoogleURLCrawler()],
    layers=[
        Critic(
            base_url=base_url,
            api_key=api_key,
            model="gpt-4o",
            sys_prompt="Now, I will present you with some image-text pairs. If they correctly correspond, respond with \"YES\"; otherwise, reply with \"NO\".",
            filter_func=lambda resp: "YES" in resp
        )
    ]
)

urls = pipeline(
    query="polar bear",
    text="more than one polar bear",
    max_n=5,
    dowload_path="download"
)

Successfully retrieved 5 images from Google.com, with 3 of them being filtered out.

image-0 image-1

About

Image Downloader is a lightweight Python script that allows you to download images from the internet based on your search queries.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages