Multi_AI_Agent / download_examples.py
SHIKARICHACHA's picture
Upload 7 files
25a1f05 verified
raw
history blame contribute delete
774 Bytes
import os
import requests
from PIL import Image
from io import BytesIO
# Create examples directory if it doesn't exist
os.makedirs("examples", exist_ok=True)
# URL of the example image
image_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
# Download and save the image
response = requests.get(image_url)
if response.status_code == 200:
# Open the image from the response content
img = Image.open(BytesIO(response.content))
# Save the image to the examples directory
img.save("examples/nature.jpg")
print("Example image downloaded successfully!")
else:
print(f"Failed to download image. Status code: {response.status_code}")