m-ric HF staff commited on
Commit
12e8eec
1 Parent(s): 0b2ea67

Update text_to_image.py

Browse files
Files changed (1) hide show
  1. text_to_image.py +4 -2
text_to_image.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from transformers.tools.base import Tool
2
  from transformers.utils import is_accelerate_available
3
  import torch
@@ -15,8 +16,9 @@ TEXT_TO_IMAGE_DESCRIPTION = (
15
  class TextToImageTool(Tool):
16
  default_checkpoint = "runwayml/stable-diffusion-v1-5"
17
  description = TEXT_TO_IMAGE_DESCRIPTION
18
- inputs = ['text']
19
- outputs = ['image']
 
20
 
21
  def __init__(self, device=None, **hub_kwargs) -> None:
22
  if not is_accelerate_available():
 
1
+ from PIL import Image
2
  from transformers.tools.base import Tool
3
  from transformers.utils import is_accelerate_available
4
  import torch
 
16
  class TextToImageTool(Tool):
17
  default_checkpoint = "runwayml/stable-diffusion-v1-5"
18
  description = TEXT_TO_IMAGE_DESCRIPTION
19
+ name = "image_generator"
20
+ inputs = {"prompt": str}
21
+ output_type = Image.Image
22
 
23
  def __init__(self, device=None, **hub_kwargs) -> None:
24
  if not is_accelerate_available():