






import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference
@slow
@require_torch_gpu
class 					a_(						unittest.TestCase					):



     """simple docstring"""



     def   __UpperCamelCase		(						self			:					Union[str, Any])    ->					Any:

      """simple docstring"""
      SCREAMING_SNAKE_CASE							  =						'runwayml/stable-diffusion-v1-5'
      SCREAMING_SNAKE_CASE							  =						TextToVideoZeroPipeline.from_pretrained(lowerCAmelCase__       ,       torch_dtype=torch.floataa).to('cuda')
      SCREAMING_SNAKE_CASE							  =						DDIMScheduler.from_config(pipe.scheduler.config)
      SCREAMING_SNAKE_CASE							  =						torch.Generator(device='cuda').manual_seed(0)

      SCREAMING_SNAKE_CASE							  =						'A bear is playing a guitar on Times Square'
      SCREAMING_SNAKE_CASE							  =						pipe(prompt=lowerCAmelCase__       ,       generator=lowerCAmelCase__).images

      SCREAMING_SNAKE_CASE							  =						load_pt(
          'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt')

      assert_mean_pixel_difference(lowerCAmelCase__       ,       lowerCAmelCase__)












from datetime import date

import requests

__UpperCAmelCase      				=							"https://api.carbonintensity.org.uk/intensity"





def 		A_			(		)							->str:







 """simple docstring"""

 SCREAMING_SNAKE_CASE							  =						requests.get(lowercase_	).json()['data'][0]
 return last_half_hour["intensity"]["actual"]





def 		A_			(		lowercase_					,       lowercase_	)							->list:







 """simple docstring"""

 return requests.get(f'''{BASE_URL}/{start}/{end}'''	).json()["data"]


if __name__ == "__main__":
      for entry in fetch_from_to(start=date(2_0_2_0, 1_0, 1), end=date(2_0_2_0, 1_0, 3)):
            print("from {from} to {to}: {intensity[actual]}".format(**entry))
      print(f'{fetch_last_half_hour() = }')




