Spaces:
Runtime error
Runtime error
import PartialState
Browse files- text_to_image.py +3 -4
text_to_image.py
CHANGED
@@ -3,7 +3,8 @@ from transformers.utils import is_accelerate_available
|
|
3 |
import torch
|
4 |
|
5 |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
6 |
-
|
|
|
7 |
|
8 |
TEXT_TO_IMAGE_DESCRIPTION = (
|
9 |
"This is a tool that creates an image according to a prompt, which is a text description. It takes an input named `prompt` which "
|
@@ -18,9 +19,7 @@ class TextToImageTool(Tool):
|
|
18 |
outputs = ['image']
|
19 |
|
20 |
def __init__(self, device=None, **hub_kwargs) -> None:
|
21 |
-
if is_accelerate_available():
|
22 |
-
from accelerate import PartialState
|
23 |
-
else:
|
24 |
raise ImportError("Accelerate should be installed in order to use tools.")
|
25 |
|
26 |
super().__init__()
|
|
|
3 |
import torch
|
4 |
|
5 |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
6 |
+
if is_accelerate_available():
|
7 |
+
from accelerate import PartialState
|
8 |
|
9 |
TEXT_TO_IMAGE_DESCRIPTION = (
|
10 |
"This is a tool that creates an image according to a prompt, which is a text description. It takes an input named `prompt` which "
|
|
|
19 |
outputs = ['image']
|
20 |
|
21 |
def __init__(self, device=None, **hub_kwargs) -> None:
|
22 |
+
if not is_accelerate_available():
|
|
|
|
|
23 |
raise ImportError("Accelerate should be installed in order to use tools.")
|
24 |
|
25 |
super().__init__()
|