User Interface 有點陽春
今天來簡單設計一下
Icon 的來源是 CoCo Datset 裡面 Overview 的 icon
下面是一個爬蟲程式,用來抓取 icon
import requests
import os
# List of image IDs to download
image_ids = [i for i in range(1, 92)]
# Base URL for downloading images
base_url = 'https://cocodataset.org/images/cocoicons/'
# Directory to save the images
save_dir = 'path to save the image'
os.makedirs(save_dir, exist_ok=True)
for image_id in image_ids:
# Construct the URL and file path
img_url = f'{base_url}{image_id}.jpg'
img_path = os.path.join(save_dir, f'{image_id}.jpg')
# Download the image
try:
response = requests.get(img_url)
response.raise_for_status() # Check for HTTP errors
with open(img_path, 'wb') as file:
file.write(response.content)
print(f'Downloaded: {img_path}')
except requests.RequestException as e:
print(f'Failed to download image {image_id}.jpg. Error: {e}')
不過要注意圖片有 91 張,但實際我們只會用到 80 張。
我們看一下爬到的圖片
比如說
teddy bear