






'''simple docstring'''



import gc
import unittest

from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline
from diffusers.utils import is_flax_available, slow
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
      import jax
      import jax.numpy as jnp
      from flax.jax_utils import replicate
      from flax.training.common_utils import shard
@slow
@require_flax
class UpperCAmelCase_					(    unittest.TestCase				):




      """simple docstring"""




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


       '''simple docstring'''

       super().tearDown()
       gc.collect()






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


       '''simple docstring'''

       lowercase  ,		lowercase					:   Optional[int]				  =FlaxStableDiffusionPipeline.from_pretrained(
           '''stabilityai/stable-diffusion-2'''     ,      revision='''bf16'''     ,      dtype=jnp.bfloataa     ,      )

       lowercase					:   Any				  ='''A painting of a squirrel eating a burger'''
       lowercase					:   int				  =jax.device_count()
       lowercase					:   Tuple				  =num_samples * [prompt]
       lowercase					:   Tuple				  =sd_pipe.prepare_inputs(A__		)

       lowercase					:   Any				  =replicate(A__		)
       lowercase					:   List[str]				  =shard(A__		)

       lowercase					:   Tuple				  =jax.random.PRNGKey(0		)
       lowercase					:   Optional[int]				  =jax.random.split(A__     ,      jax.device_count()		)

       lowercase					:   Tuple				  =sd_pipe(A__     ,      A__     ,      A__     ,      num_inference_steps=25     ,      jit=A__		)[0]
       assert images.shape == (jax.device_count(), 1, 768, 768, 3)

       lowercase					:   Union[str, Any]				  =images.reshape((images.shape[0] * images.shape[1],) + images.shape[-3:]		)
       lowercase					:   List[Any]				  =images[0, 253:256, 253:256, -1]

       lowercase					:   Any				  =jnp.asarray(jax.device_get(image_slice.flatten()		)		)
       lowercase					:   str				  =jnp.array([0.4_2_3_8, 0.4_4_1_4, 0.4_3_9_5, 0.4_4_5_3, 0.4_6_2_9, 0.4_5_9_0, 0.4_5_3_1, 0.4_5_5_0_8, 0.4_5_1_2]		)
       print(f'output_slice: {output_slice}'		)
       assert jnp.abs(output_slice - expected_slice		).max() < 1e-2






      def 				A__      ( self			:		int		)  ->  Any:


       '''simple docstring'''

       lowercase					:   Optional[Any]				  ='''stabilityai/stable-diffusion-2'''
       lowercase  ,		lowercase					:   Union[str, Any]				  =FlaxDPMSolverMultistepScheduler.from_pretrained(A__     ,      subfolder='''scheduler'''		)
       lowercase  ,		lowercase					:   Optional[int]				  =FlaxStableDiffusionPipeline.from_pretrained(
           A__     ,      scheduler=A__     ,      revision='''bf16'''     ,      dtype=jnp.bfloataa     ,      )
       lowercase					:   Union[str, Any]				  =scheduler_params

       lowercase					:   Optional[Any]				  ='''A painting of a squirrel eating a burger'''
       lowercase					:   Dict				  =jax.device_count()
       lowercase					:   Optional[int]				  =num_samples * [prompt]
       lowercase					:   Any				  =sd_pipe.prepare_inputs(A__		)

       lowercase					:   Optional[int]				  =replicate(A__		)
       lowercase					:   Optional[Any]				  =shard(A__		)

       lowercase					:   List[str]				  =jax.random.PRNGKey(0		)
       lowercase					:   Optional[int]				  =jax.random.split(A__     ,      jax.device_count()		)

       lowercase					:   int				  =sd_pipe(A__     ,      A__     ,      A__     ,      num_inference_steps=25     ,      jit=A__		)[0]
       assert images.shape == (jax.device_count(), 1, 768, 768, 3)

       lowercase					:   str				  =images.reshape((images.shape[0] * images.shape[1],) + images.shape[-3:]		)
       lowercase					:   Union[str, Any]				  =images[0, 253:256, 253:256, -1]

       lowercase					:   Tuple				  =jnp.asarray(jax.device_get(image_slice.flatten()		)		)
       lowercase					:   Union[str, Any]				  =jnp.array([0.4_3_3_6, 0.4_2_9_6_9, 0.4_4_5_3, 0.4_1_9_9, 0.4_2_9_7, 0.4_5_3_1, 0.4_4_3_4, 0.4_4_3_4, 0.4_2_9_7]		)
       print(f'output_slice: {output_slice}'		)
       assert jnp.abs(output_slice - expected_slice		).max() < 1e-2











'''simple docstring'''



from __future__ import annotations

from collections.abc import Generator

import requests
from bsa import BeautifulSoup

SCREAMING_SNAKE_CASE						=	'https://www.indeed.co.in/jobs?q=mobile+app+development&l='


def 							lowercase_				(    __A :       str = "mumbai"			)       ->      Generator[tuple[str, str], None, None]:



 """simple docstring"""




 lowercase					:   List[Any]				  =BeautifulSoup(requests.get(url + location			).content					,      '''html.parser'''			)
 # This attribute finds out all the specifics listed in a job
 for job in soup.find_all('''div'''					,      attrs={'''data-tn-component''': '''organicJob'''}			):
  lowercase					:   List[str]				  =job.find('''a'''					,      attrs={'''data-tn-element''': '''jobTitle'''}			).text.strip()
  lowercase					:   Union[str, Any]				  =job.find('''span'''					,      {'''class''': '''company'''}			).text.strip()
  yield job_title, company_name


if __name__ == "__main__":
      for i, job in enumerate(fetch_jobs('Bangalore'), 1):
            print(f"""Job {i:>2} is {job[0]} at {job[1]}""")



