Download ppdiffusers/pipelines/stable_diffusion/__init__.py from 1toTree/lora_test: direct link, hf CLI and curl.
- Browser
- Download file 4.28 kB
-
https://huggingface.co/spaces/1toTree/lora_test/resolve/main/ppdiffusers/pipelines/stable_diffusion/__init__.py
- Command line
-
hf download hf://spaces/1toTree/lora_test/ppdiffusers/pipelines/stable_diffusion/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/1toTree/lora_test/resolve/main/ppdiffusers/pipelines/stable_diffusion/__init__.py
4.28 kB
| # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | |
| # Copyright 2022 The HuggingFace Team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # flake8: noqa | |
| from dataclasses import dataclass | |
| from typing import List, Optional, Union | |
| import numpy as np | |
| import PIL | |
| from ...utils import ( | |
| BaseOutput, | |
| OptionalDependencyNotAvailable, | |
| is_fastdeploy_available, | |
| is_k_diffusion_available, | |
| is_paddle_available, | |
| is_paddlenlp_available, | |
| ) | |
| class StableDiffusionPipelineOutput(BaseOutput): | |
| """ | |
| Output class for Stable Diffusion pipelines. | |
| Args: | |
| images (`List[PIL.Image.Image]` or `np.ndarray`) | |
| List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, | |
| num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. | |
| nsfw_content_detected (`List[bool]`) | |
| List of flags denoting whether the corresponding generated image likely represents "not-safe-for-work" | |
| (nsfw) content, or `None` if safety checking could not be performed. | |
| """ | |
| images: Union[List[PIL.Image.Image], np.ndarray] | |
| nsfw_content_detected: Optional[List[bool]] | |
| try: | |
| if not (is_paddlenlp_available() and is_paddle_available()): | |
| raise OptionalDependencyNotAvailable() | |
| except OptionalDependencyNotAvailable: | |
| from ...utils.dummy_paddle_and_paddlenlp_objects import ( | |
| StableDiffusionDepth2ImgPipeline, | |
| ) | |
| else: | |
| from .pipeline_stable_diffusion_depth2img import StableDiffusionDepth2ImgPipeline | |
| if is_paddlenlp_available() and is_paddle_available(): | |
| from .pipeline_cycle_diffusion import CycleDiffusionPipeline | |
| from .pipeline_stable_diffusion import StableDiffusionPipeline | |
| from .pipeline_stable_diffusion_all_in_one import StableDiffusionPipelineAllinOne | |
| from .pipeline_stable_diffusion_img2img import StableDiffusionImg2ImgPipeline | |
| from .pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipeline | |
| from .pipeline_stable_diffusion_inpaint_legacy import ( | |
| StableDiffusionInpaintPipelineLegacy, | |
| ) | |
| from .pipeline_stable_diffusion_mega import StableDiffusionMegaPipeline | |
| from .pipeline_stable_diffusion_upscale import StableDiffusionUpscalePipeline | |
| from .safety_checker import StableDiffusionSafetyChecker | |
| try: | |
| if not (is_paddlenlp_available() and is_paddle_available()): | |
| raise OptionalDependencyNotAvailable() | |
| except OptionalDependencyNotAvailable: | |
| from ...utils.dummy_paddle_and_paddlenlp_objects import ( | |
| StableDiffusionImageVariationPipeline, | |
| ) | |
| else: | |
| from .pipeline_stable_diffusion_image_variation import ( | |
| StableDiffusionImageVariationPipeline, | |
| ) | |
| try: | |
| if not (is_paddle_available() and is_paddlenlp_available() and is_k_diffusion_available()): | |
| raise OptionalDependencyNotAvailable() | |
| except OptionalDependencyNotAvailable: | |
| from ...utils.dummy_paddle_and_paddlenlp_and_k_diffusion_objects import * # noqa F403 | |
| else: | |
| from .pipeline_stable_diffusion_k_diffusion import StableDiffusionKDiffusionPipeline | |
| if is_paddlenlp_available() and is_fastdeploy_available(): | |
| from .pipeline_fastdeploy_stable_diffusion import FastDeployStableDiffusionPipeline | |
| from .pipeline_fastdeploy_stable_diffusion_img2img import ( | |
| FastDeployStableDiffusionImg2ImgPipeline, | |
| ) | |
| from .pipeline_fastdeploy_stable_diffusion_inpaint import ( | |
| FastDeployStableDiffusionInpaintPipeline, | |
| ) | |
| from .pipeline_fastdeploy_stable_diffusion_inpaint_legacy import ( | |
| FastDeployStableDiffusionInpaintPipelineLegacy, | |
| ) | |
| from .pipeline_fastdeploy_stable_diffusion_mega import ( | |
| FastDeployStableDiffusionMegaPipeline, | |
| ) | |