





import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionImageVariationPipeline
from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device


_SCREAMING_SNAKE_CASE      	=		False
class SCREAMING_SNAKE_CASE_						(					unittest.TestCase					):
						pass
@slow
@require_torch_gpu
class SCREAMING_SNAKE_CASE_						(					unittest.TestCase					):






						def UpperCAmelCase_				(      self      :      List[Any]	)							->    str:







							"""simple docstring"""


							snake_case_		:			Union[str, Any]											=	VersatileDiffusionImageVariationPipeline.from_pretrained('shi-labs/versatile-diffusion'	)
							pipe.to(_A	)
							pipe.set_progress_bar_config(disable=_A	)

							snake_case_		:			Any											=	load_image(
							    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg'	)
							snake_case_		:			Any											=	torch.manual_seed(0	)
							snake_case_		:			Any											=	pipe(
							    image=_A		,   generator=_A		,   guidance_scale=7.5		,   num_inference_steps=50		,   output_type='numpy'		,   ).images

							snake_case_		:			List[Any]											=	image[0, 253:256, 253:256, -1]

							assert image.shape == (1, 512, 512, 3)
							snake_case_		:			Optional[int]											=	np.array([0.0_4_4_1, 0.0_4_6_9, 0.0_5_0_7, 0.0_5_7_5, 0.0_6_3_2, 0.0_6_5_0, 0.0_8_6_5, 0.0_9_0_9, 0.0_9_4_5]	)

							assert np.abs(image_slice.flatten() - expected_slice	).max() < 1E-2








import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
						_SCREAMING_SNAKE_CASE      	=		"""%20""".join(argv[1:]) if len(argv) > 1 else quote(str(input("""Search: """)))

						print("""Googling.....""")

						_SCREAMING_SNAKE_CASE      	=		F'''https://www.google.com/search?q={query}&num=100'''

						_SCREAMING_SNAKE_CASE      	=		requests.get(
						    url,
						    headers={"""User-Agent""": str(UserAgent().random)},
						)

						try:
												_SCREAMING_SNAKE_CASE      	=		(
												    BeautifulSoup(res.text, """html.parser""")
												    .find("""div""", attrs={"""class""": """yuRUbf"""})
												    .find("""a""")
												    .get("""href""")
												)

						except AttributeError:
												_SCREAMING_SNAKE_CASE      	=		parse_qs(
												    BeautifulSoup(res.text, """html.parser""")
												    .find("""div""", attrs={"""class""": """kCrYT"""})
												    .find("""a""")
												    .get("""href""")
												)["""url"""][0]

						webbrowser.open(link)

