Spaces:
Sleeping
Sleeping
Update image_transformation.py
Browse files- image_transformation.py +1 -6
image_transformation.py
CHANGED
|
@@ -5,18 +5,15 @@ import torch
|
|
| 5 |
from transformers.tools.base import Tool, get_default_device
|
| 6 |
from transformers.utils import (
|
| 7 |
is_accelerate_available,
|
| 8 |
-
is_diffusers_available,
|
| 9 |
is_vision_available,
|
| 10 |
is_opencv_available,
|
| 11 |
)
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
if is_vision_available():
|
| 15 |
from PIL import Image
|
| 16 |
|
| 17 |
-
if is_diffusers_available():
|
| 18 |
-
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
|
| 19 |
-
|
| 20 |
if is_opencv_available():
|
| 21 |
import cv2
|
| 22 |
|
|
@@ -39,8 +36,6 @@ class ControlNetTransformationTool(Tool):
|
|
| 39 |
def __init__(self, device=None, controlnet=None, stable_diffusion=None, **hub_kwargs) -> None:
|
| 40 |
if not is_accelerate_available():
|
| 41 |
raise ImportError("Accelerate should be installed in order to use tools.")
|
| 42 |
-
if not is_diffusers_available():
|
| 43 |
-
raise ImportError("Diffusers should be installed in order to use the StableDiffusionTool.")
|
| 44 |
if not is_vision_available():
|
| 45 |
raise ImportError("Pillow should be installed in order to use the StableDiffusionTool.")
|
| 46 |
|
|
|
|
| 5 |
from transformers.tools.base import Tool, get_default_device
|
| 6 |
from transformers.utils import (
|
| 7 |
is_accelerate_available,
|
|
|
|
| 8 |
is_vision_available,
|
| 9 |
is_opencv_available,
|
| 10 |
)
|
| 11 |
+
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
|
| 12 |
|
| 13 |
|
| 14 |
if is_vision_available():
|
| 15 |
from PIL import Image
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
if is_opencv_available():
|
| 18 |
import cv2
|
| 19 |
|
|
|
|
| 36 |
def __init__(self, device=None, controlnet=None, stable_diffusion=None, **hub_kwargs) -> None:
|
| 37 |
if not is_accelerate_available():
|
| 38 |
raise ImportError("Accelerate should be installed in order to use tools.")
|
|
|
|
|
|
|
| 39 |
if not is_vision_available():
|
| 40 |
raise ImportError("Pillow should be installed in order to use the StableDiffusionTool.")
|
| 41 |
|