




import gc
import tempfile
import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionDualGuidedPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device


a_      						=   False

@nightly
@require_torch_gpu
class        _lowerCamelCase  (	unittest.TestCase      ):

      """simple docstring"""

      def 					snake_case		(   self    :       Tuple ):
          # clean up the VRAM after each test
          super().tearDown()
          gc.collect()
          torch.cuda.empty_cache()







      def 					snake_case		(   self    :       Optional[int] ):
          __UpperCamelCase     						=  VersatileDiffusionDualGuidedPipeline.from_pretrained('''shi-labs/versatile-diffusion''' )
          # remove text_unet
          pipe.remove_unused_weights()
          pipe.to(UpperCAmelCase_ )
          pipe.set_progress_bar_config(disable=UpperCAmelCase_ )

          __UpperCamelCase     						=  load_image(
              '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg''' )

          __UpperCamelCase     						=  torch.manual_seed(0 )
          __UpperCamelCase     						=  pipe(
              prompt='''first prompt'''       ,				image=UpperCAmelCase_       ,				text_to_image_strength=0.75       ,				generator=UpperCAmelCase_       ,				guidance_scale=7.5       ,				num_inference_steps=2       ,				output_type='''numpy'''       ,				).images

          with tempfile.TemporaryDirectory() as tmpdirname:
              pipe.save_pretrained(UpperCAmelCase_ )
              __UpperCamelCase     						=  VersatileDiffusionDualGuidedPipeline.from_pretrained(UpperCAmelCase_ )

          pipe.to(UpperCAmelCase_ )
          pipe.set_progress_bar_config(disable=UpperCAmelCase_ )

          __UpperCamelCase     						=  generator.manual_seed(0 )
          __UpperCamelCase     						=  pipe(
              prompt='''first prompt'''       ,				image=UpperCAmelCase_       ,				text_to_image_strength=0.75       ,				generator=UpperCAmelCase_       ,				guidance_scale=7.5       ,				num_inference_steps=2       ,				output_type='''numpy'''       ,				).images

          assert np.abs(image - new_image ).sum() < 1E-5, "Models don't have the same forward pass"







      def 					snake_case		(   self    :       int ):
          __UpperCamelCase     						=  VersatileDiffusionDualGuidedPipeline.from_pretrained('''shi-labs/versatile-diffusion''' )
          pipe.remove_unused_weights()
          pipe.to(UpperCAmelCase_ )
          pipe.set_progress_bar_config(disable=UpperCAmelCase_ )

          __UpperCamelCase     						=  """cyberpunk 2077"""
          __UpperCamelCase     						=  load_image(
              '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg''' )
          __UpperCamelCase     						=  torch.manual_seed(0 )
          __UpperCamelCase     						=  pipe(
              prompt=UpperCAmelCase_       ,				image=UpperCAmelCase_       ,				text_to_image_strength=0.75       ,				generator=UpperCAmelCase_       ,				guidance_scale=7.5       ,				num_inference_steps=50       ,				output_type='''numpy'''       ,				).images

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

          assert image.shape == (1, 512, 512, 3)
          __UpperCamelCase     						=  np.array([0.07_87, 0.08_49, 0.08_26, 0.08_12, 0.08_07, 0.07_95, 0.08_18, 0.07_98, 0.07_79] )

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











"""simple docstring"""







import requests
from bsa import BeautifulSoup


def       __SCREAMING_SNAKE_CASE      (   __UpperCAmelCase					,							__UpperCAmelCase	):
		_lowercase							:      Dict			=					(
		    """https://www.horoscope.com/us/horoscopes/general/"""
		    F"""horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"""
		)
		_lowercase							:      Any			=					BeautifulSoup(requests.get(__UpperCAmelCase	).content					,							"""html.parser"""	)
		return soup.find("""div"""					,							class_="""main-horoscope"""	).p.text


if __name__ == "__main__":
		print("""Daily Horoscope. \n""")
		print(
		    """enter your Zodiac sign number:\n""",
		    """1. Aries\n""",
		    """2. Taurus\n""",
		    """3. Gemini\n""",
		    """4. Cancer\n""",
		    """5. Leo\n""",
		    """6. Virgo\n""",
		    """7. Libra\n""",
		    """8. Scorpio\n""",
		    """9. Sagittarius\n""",
		    """10. Capricorn\n""",
		    """11. Aquarius\n""",
		    """12. Pisces\n""",
		)
		UpperCAmelCase:   Union[str, Any]       			=							int(input("""number> """).strip())
		print("""choose some day:\n""", """yesterday\n""", """today\n""", """tomorrow\n""")
		UpperCAmelCase:   List[Any]       			=							input("""enter the day> """)
		UpperCAmelCase:   List[Any]       			=							horoscope(zodiac_sign, day)
		print(horoscope_text)



