Skip to content

Commit

Permalink
Merge pull request chenfei-wu#11 from bojieli/main
Browse files Browse the repository at this point in the history
fix typos in the description text
  • Loading branch information
WeizhenQ authored Mar 9, 2023
2 parents 06b4336 + 8976663 commit 637f794
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Here we list the GPU memory usage of each visual foundation model, one can modif

| Fundation Model | Memory Usage (MB) |
|------------------------|-------------------|
| ImageEditing | 6667 |
| ImageEditing | 6667 |
| ImageCaption | 1755 |
| T2I | 6677 |
| canny2image | 5540 |
Expand Down
52 changes: 26 additions & 26 deletions visual_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

VISUAL_CHATGPT_PREFIX = """Visual ChatGPT is designed to be able to assist with a wide range of text and visual related tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. Visual ChatGPT is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
Visual ChatGPT is able to process and understand large amounts of text and image. As a language model, Visual ChatGPT can not directly read images, but it has a list of tools to finish different visual tasks. Each image will have a file name formed as "image/xxx.png", and Visual ChatGPT can invoke different tools to indirectly understand pictures. When talking about images, Visual ChatGPT is very strict to the file name and will never fabricate nonexistent files. When using tools to generate new image files, Visual ChatGPT is also known that the image may not be the same as user's demand, and will use other visual question answering tools or description tools to observe the real image. Visual ChatGPT is able to use tools in a sequence, and is loyal to the tool observation outputs rather than faking the image content and image file name. It will remember to provide the file name from the last tool observation, if a new image is generated.
Visual ChatGPT is able to process and understand large amounts of text and images. As a language model, Visual ChatGPT can not directly read images, but it has a list of tools to finish different visual tasks. Each image will have a file name formed as "image/xxx.png", and Visual ChatGPT can invoke different tools to indirectly understand pictures. When talking about images, Visual ChatGPT is very strict to the file name and will never fabricate nonexistent files. When using tools to generate new image files, Visual ChatGPT is also known that the image may not be the same as the user's demand, and will use other visual question answering tools or description tools to observe the real image. Visual ChatGPT is able to use tools in a sequence, and is loyal to the tool observation outputs rather than faking the image content and image file name. It will remember to provide the file name from the last tool observation, if a new image is generated.
Human may provide new figures to Visual ChatGPT with a description. The description helps Visual ChatGPT to understand this image, but Visual ChatGPT should use tools to finish following tasks, rather than directly imagine from the description.
Expand Down Expand Up @@ -65,8 +65,8 @@
```
"""

VISUAL_CHATGPT_SUFFIX = """You are very strict to the filename correctness and will never fake a file name if not exists.
You will remember to provide the image file name loyally if it's provided in the last tool observation.
VISUAL_CHATGPT_SUFFIX = """You are very strict to the filename correctness and will never fake a file name if it does not exist.
You will remember to provide the image file name loyally if it's provided in the last tool observation.
Begin!
Expand Down Expand Up @@ -149,7 +149,7 @@ def __init__(self, device):
print("Initializing StableDiffusionInpaint to %s" % device)
self.device = device
self.mask_former = MaskFormer(device=self.device)
self.inpainting = StableDiffusionInpaintPipeline.from_pretrained( "runwayml/stable-diffusion-inpainting",).to(device)
self.inpainting = StableDiffusionInpaintPipeline.from_pretrained("runwayml/stable-diffusion-inpainting",).to(device)

def remove_part_of_image(self, input):
image_path, to_be_removed_txt = input.split(",")
Expand Down Expand Up @@ -825,71 +825,71 @@ def __init__(self):
self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
self.tools = [
Tool(name="Get Photo Description", func=self.i2t.inference,
description="useful for when you want to know what is inside the photo. receives image_path as input. "
description="useful when you want to know what is inside the photo. receives image_path as input. "
"The input to this tool should be a string, representing the image_path. "),
Tool(name="Generate Image From User Input Text", func=self.t2i.inference,
description="useful for when you want to generate an image from a user input text and it saved it to a file. like: generate an image of an object or something, or generate an image that includes some objects. "
description="useful when you want to generate an image from a user input text and save it to a file. like: generate an image of an object or something, or generate an image that includes some objects. "
"The input to this tool should be a string, representing the text used to generate image. "),
Tool(name="Remove Something From The Photo", func=self.edit.remove_part_of_image,
description="useful for when you want to remove and object or something from the photo from its description or location. "
description="useful when you want to remove and object or something from the photo from its description or location. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the object need to be removed. "),
Tool(name="Replace Something From The Photo", func=self.edit.replace_part_of_image,
description="useful for when you want to replace an object from the object description or location with another object from its description. "
description="useful when you want to replace an object from the object description or location with another object from its description. "
"The input to this tool should be a comma seperated string of three, representing the image_path, the object to be replaced, the object to be replaced with "),

Tool(name="Instruct Image Using Text", func=self.pix2pix.inference,
description="useful for when you want to the style of the image to be like the text. like: make it look like a painting. or make it like a robot. "
description="useful when you want to the style of the image to be like the text. like: make it look like a painting. or make it like a robot. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the text. "),
Tool(name="Answer Question About The Image", func=self.BLIPVQA.get_answer_from_question_and_image,
description="useful for when you need an answer for a question based on an image. like: what is the background color of the last image, how many cats in this figure, what is in this figure. "
description="useful when you need an answer for a question based on an image. like: what is the background color of the last image, how many cats in this figure, what is in this figure. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the question"),
Tool(name="Edge Detection On Image", func=self.image2canny.inference,
description="useful for when you want to detect the edge of the image. like: detect the edges of this image, or canny detection on image, or peform edge detection on this image, or detect the canny image of this image. "
description="useful when you want to detect the edge of the image. like: detect the edges of this image, or canny detection on image, or peform edge detection on this image, or detect the canny image of this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Canny Image", func=self.canny2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and a canny image. like: generate a real image of a object or something from this canny image, or generate a new real image of a object or something from this edge image. "
description="useful when you want to generate a new real image from both the user desciption and a canny image. like: generate a real image of a object or something from this canny image, or generate a new real image of a object or something from this edge image. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description. "),
Tool(name="Line Detection On Image", func=self.image2line.inference,
description="useful for when you want to detect the straight line of the image. like: detect the straight lines of this image, or straight line detection on image, or peform straight line detection on this image, or detect the straight line image of this image. "
description="useful when you want to detect the straight line of the image. like: detect the straight lines of this image, or straight line detection on image, or peform straight line detection on this image, or detect the straight line image of this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Line Image", func=self.line2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and a straight line image. like: generate a real image of a object or something from this straight line image, or generate a new real image of a object or something from this straight lines. "
description="useful when you want to generate a new real image from both the user desciption and a straight line image. like: generate a real image of a object or something from this straight line image, or generate a new real image of a object or something from this straight lines. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description. "),
Tool(name="Hed Detection On Image", func=self.image2hed.inference,
description="useful for when you want to detect the soft hed boundary of the image. like: detect the soft hed boundary of this image, or hed boundary detection on image, or peform hed boundary detection on this image, or detect soft hed boundary image of this image. "
description="useful when you want to detect the soft hed boundary of the image. like: detect the soft hed boundary of this image, or hed boundary detection on image, or peform hed boundary detection on this image, or detect soft hed boundary image of this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Soft Hed Boundary Image", func=self.hed2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and a soft hed boundary image. like: generate a real image of a object or something from this soft hed boundary image, or generate a new real image of a object or something from this hed boundary. "
description="useful when you want to generate a new real image from both the user desciption and a soft hed boundary image. like: generate a real image of a object or something from this soft hed boundary image, or generate a new real image of a object or something from this hed boundary. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description"),
Tool(name="Segmentation On Image", func=self.image2seg.inference,
description="useful for when you want to detect segmentations of the image. like: segment this image, or generate segmentations on this image, or peform segmentation on this image. "
description="useful when you want to detect segmentations of the image. like: segment this image, or generate segmentations on this image, or peform segmentation on this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Segmentations", func=self.seg2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and segmentations. like: generate a real image of a object or something from this segmentation image, or generate a new real image of a object or something from these segmentations. "
description="useful when you want to generate a new real image from both the user desciption and segmentations. like: generate a real image of a object or something from this segmentation image, or generate a new real image of a object or something from these segmentations. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description"),
Tool(name="Predict Depth On Image", func=self.image2depth.inference,
description="useful for when you want to detect depth of the image. like: generate the depth from this image, or detect the depth map on this image, or predict the depth for this image. "
description="useful when you want to detect depth of the image. like: generate the depth from this image, or detect the depth map on this image, or predict the depth for this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Depth", func=self.depth2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and depth image. like: generate a real image of a object or something from this depth image, or generate a new real image of a object or something from the depth map. "
description="useful when you want to generate a new real image from both the user desciption and depth image. like: generate a real image of a object or something from this depth image, or generate a new real image of a object or something from the depth map. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description"),
Tool(name="Predict Normal Map On Image", func=self.image2normal.inference,
description="useful for when you want to detect norm map of the image. like: generate normal map from this image, or predict normal map of this image. "
description="useful when you want to detect norm map of the image. like: generate normal map from this image, or predict normal map of this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Normal Map", func=self.normal2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and normal map. like: generate a real image of a object or something from this normal map, or generate a new real image of a object or something from the normal map. "
description="useful when you want to generate a new real image from both the user desciption and normal map. like: generate a real image of a object or something from this normal map, or generate a new real image of a object or something from the normal map. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description"),
Tool(name="Sketch Detection On Image", func=self.image2scribble.inference,
description="useful for when you want to generate a scribble of the image. like: generate a scribble of this image, or generate a sketch from this image, detect the sketch from this image. "
description="useful when you want to generate a scribble of the image. like: generate a scribble of this image, or generate a sketch from this image, detect the sketch from this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Sketch Image", func=self.scribble2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and a scribble image or a sketch image. "
description="useful when you want to generate a new real image from both the user desciption and a scribble image or a sketch image. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description"),
Tool(name="Pose Detection On Image", func=self.image2pose.inference,
description="useful for when you want to detect the human pose of the image. like: generate human poses of this image, or generate a pose image from this image. "
description="useful when you want to detect the human pose of the image. like: generate human poses of this image, or generate a pose image from this image. "
"The input to this tool should be a string, representing the image_path"),
Tool(name="Generate Image Condition On Pose Image", func=self.pose2image.inference,
description="useful for when you want to generate a new real image from both the user desciption and a human pose image. like: generate a real image of a human from this human pose image, or generate a new real image of a human from this pose. "
description="useful when you want to generate a new real image from both the user desciption and a human pose image. like: generate a real image of a human from this human pose image, or generate a new real image of a human from this pose. "
"The input to this tool should be a comma seperated string of two, representing the image_path and the user description")]
self.agent = initialize_agent(
self.tools,
Expand Down

0 comments on commit 637f794

Please sign in to comment.