import webbrowser
import random
# List of image URLs (you can add more URLs to this list)
image_urls = [
"https://as2.ftcdn.net/v2/jpg/02/18/74/27/1000_F_218742793_e5PRjoGWGEjFKSPrfusqCHYjO2co6OSa.jpg",
"https://as1.ftcdn.net/v2/jpg/03/39/85/10/1000_F_339851080_P6SR0J8n3h0LQm5zp9uFqqbthpmqJIKZ.jpg",
"https://as2.ftcdn.net/v2/jpg/03/64/82/31/1000_F_364823124_NAvSKQHt8MaATZmBn3T5O43I52OXvSg9.jpg",
"https://as1.ftcdn.net/v2/jpg/02/90/62/32/1000_F_290623279_cYg2xAuiLtg2zvmJGl3Zn4Ducobj3itW.jpg",
"https://as2.ftcdn.net/v2/jpg/02/53/16/85/1000_F_253168519_THRQ88DESoR2piFbddOPolV8WnyXTWKm.jpg",
"https://as2.ftcdn.net/v2/jpg/02/47/04/69/1000_F_247046900_qOr9SVbxR9nTqsm0JTJCsvpUEEHPeKhL.jpg",
# Add more image URLs here
]
def open_random_image():
random_url = random.choice(image_urls)
webbrowser.open(random_url)
# You can call open_random_image when needed, for example, in response to a button click event
open_random_image()
%%html
<html>
<head>
<title>Random Image Opener</title>
</head>
<body>
<h1>Random Image Opener</h1>
<button onclick="openRandomImage()">Open Random Image</button>
<script>
// List of image URLs (you can add more URLs to this list)
const imageUrls = [
"https://as2.ftcdn.net/v2/jpg/02/18/74/27/1000_F_218742793_e5PRjoGWGEjFKSPrfusqCHYjO2co6OSa.jpg",
"https://as1.ftcdn.net/v2/jpg/03/39/85/10/1000_F_339851080_P6SR0J8n3h0LQm5zp9uFqqbthpmqJIKZ.jpg",
"https://as2.ftcdn.net/v2/jpg/03/64/82/31/1000_F_364823124_NAvSKQHt8MaATZmBn3T5O43I52OXvSg9.jpg",
"https://as1.ftcdn.net/v2/jpg/02/90/62/32/1000_F_290623279_cYg2xAuiLtg2zvmJGl3Zn4Ducobj3itW.jpg",
"https://as2.ftcdn.net/v2/jpg/02/53/16/85/1000_F_253168519_THRQ88DESoR2piFbddOPolV8WnyXTWKm.jpg",
"https://as2.ftcdn.net/v2/jpg/02/47/04/69/1000_F_247046900_qOr9SVbxR9nTqsm0JTJCsvpUEEHPeKhL.jpg",
// Add more image URLs here
];
function openRandomImage() {
const randomIndex = Math.floor(Math.random() * imageUrls.length);
const randomUrl = imageUrls[randomIndex];
window.open(randomUrl, '_blank');
}
</script>
</body>
</html>