m-ric HF staff commited on
Commit
f5caac8
1 Parent(s): b366bb7

Update text_to_image.py

Browse files
Files changed (1) hide show
  1. text_to_image.py +3 -1
text_to_image.py CHANGED
@@ -1,6 +1,8 @@
1
  from transformers.agents.tools import Tool
2
  from transformers.utils import is_accelerate_available
3
  import torch
 
 
4
 
5
  from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
6
  if is_accelerate_available():
@@ -10,7 +12,7 @@ TEXT_TO_IMAGE_DESCRIPTION = (
10
  "This is a tool that creates an image according to a prompt."
11
  )
12
 
13
-
14
  class TextToImageTool(Tool):
15
  default_checkpoint = "runwayml/stable-diffusion-v1-5"
16
  description = TEXT_TO_IMAGE_DESCRIPTION
 
1
  from transformers.agents.tools import Tool
2
  from transformers.utils import is_accelerate_available
3
  import torch
4
+ import spaces
5
+
6
 
7
  from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
8
  if is_accelerate_available():
 
12
  "This is a tool that creates an image according to a prompt."
13
  )
14
 
15
+ @spaces.GPU
16
  class TextToImageTool(Tool):
17
  default_checkpoint = "runwayml/stable-diffusion-v1-5"
18
  description = TEXT_TO_IMAGE_DESCRIPTION