m-ric HF staff commited on
Commit
5109976
1 Parent(s): a3677bb

Update text_to_image.py

Browse files
Files changed (1) hide show
  1. text_to_image.py +3 -4
text_to_image.py CHANGED
@@ -1,4 +1,3 @@
1
- from PIL import Image
2
  from transformers.agents.tools import Tool
3
  from transformers.utils import is_accelerate_available
4
  import torch
@@ -8,7 +7,7 @@ if is_accelerate_available():
8
  from accelerate import PartialState
9
 
10
  TEXT_TO_IMAGE_DESCRIPTION = (
11
- "This is a tool that creates an image according to a prompt, which is a text description."
12
  )
13
 
14
 
@@ -16,8 +15,8 @@ class TextToImageTool(Tool):
16
  default_checkpoint = "runwayml/stable-diffusion-v1-5"
17
  description = TEXT_TO_IMAGE_DESCRIPTION
18
  name = "image_generator"
19
- inputs = {"prompt": {"type": str, "description": "contains the image description and outputs an image"}}
20
- output_type = Image.Image
21
 
22
  def __init__(self, device=None, **hub_kwargs) -> None:
23
  if not is_accelerate_available():
 
 
1
  from transformers.agents.tools import Tool
2
  from transformers.utils import is_accelerate_available
3
  import torch
 
7
  from accelerate import PartialState
8
 
9
  TEXT_TO_IMAGE_DESCRIPTION = (
10
+ "This is a tool that creates an image according to a prompt."
11
  )
12
 
13
 
 
15
  default_checkpoint = "runwayml/stable-diffusion-v1-5"
16
  description = TEXT_TO_IMAGE_DESCRIPTION
17
  name = "image_generator"
18
+ inputs = {"prompt": {"type": "text", "description": "the image description"}}
19
+ output_type = "image"
20
 
21
  def __init__(self, device=None, **hub_kwargs) -> None:
22
  if not is_accelerate_available():