





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


_UpperCAmelCase		:       Dict						    =	False







class 			lowercase    (	unittest.TestCase      ):
				pass







@slow
@require_torch_gpu
class 			lowercase    (	unittest.TestCase      ):




				def    a							( self	):
											snake_case_          =   VersatileDiffusionImageVariationPipeline.from_pretrained('shi-labs/versatile-diffusion'	)
											pipe.to(lowercase_	)
											pipe.set_progress_bar_config(disable=lowercase_	)

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

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

											assert image.shape == (1, 512, 512, 3)
											snake_case_          =   np.array([0.04_41, 0.04_69, 0.05_07, 0.05_75, 0.06_32, 0.06_50, 0.08_65, 0.09_09, 0.09_45]	)

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







import requests

_UpperCAmelCase		:       Union[str, Any]						    =	"""https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey="""





def  __lowerCamelCase     (			UpperCamelCase__				):







							'''simple docstring'''






							snake_case_          =   requests.get(_NEWS_API + bbc_news_api_key				).json()
							# each article in the list is a dict
							for i, article in enumerate(bbc_news_page['articles']       ,							1				):
														print(F'''{i}.) {article["title"]}'''				)


if __name__ == "__main__":
					fetch_bbc_news(bbc_news_api_key="""<Your BBC News API key goes here>""")




