Spaces:
Runtime error
Runtime error
Commit
·
de0e542
1
Parent(s):
e3c2978
Add edit image and pix2pix options
Browse files
app.py
CHANGED
|
@@ -347,7 +347,7 @@ class BLIPVQA:
|
|
| 347 |
class ConversationBot:
|
| 348 |
def __init__(self):
|
| 349 |
print("Initializing VisualChatGPT")
|
| 350 |
-
|
| 351 |
self.i2t = ImageCaptioning(device="cuda:0")
|
| 352 |
self.t2i = T2I(device="cuda:0")
|
| 353 |
self.image2canny = image2canny()
|
|
@@ -355,7 +355,7 @@ class ConversationBot:
|
|
| 355 |
self.image2pose = image2pose()
|
| 356 |
self.pose2image = pose2image(device="cuda:0")
|
| 357 |
self.BLIPVQA = BLIPVQA(device="cuda:0")
|
| 358 |
-
|
| 359 |
self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
|
| 360 |
self.tools = [
|
| 361 |
Tool(name="Get Photo Description", func=self.i2t.inference,
|
|
@@ -364,16 +364,16 @@ class ConversationBot:
|
|
| 364 |
Tool(name="Generate Image From User Input Text", func=self.t2i.inference,
|
| 365 |
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. "
|
| 366 |
"The input to this tool should be a string, representing the text used to generate image. "),
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
Tool(name="Answer Question About The Image", func=self.BLIPVQA.get_answer_from_question_and_image,
|
| 378 |
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. "
|
| 379 |
"The input to this tool should be a comma seperated string of two, representing the image_path and the question"),
|
|
|
|
| 347 |
class ConversationBot:
|
| 348 |
def __init__(self):
|
| 349 |
print("Initializing VisualChatGPT")
|
| 350 |
+
self.edit = ImageEditing(device="cuda:0")
|
| 351 |
self.i2t = ImageCaptioning(device="cuda:0")
|
| 352 |
self.t2i = T2I(device="cuda:0")
|
| 353 |
self.image2canny = image2canny()
|
|
|
|
| 355 |
self.image2pose = image2pose()
|
| 356 |
self.pose2image = pose2image(device="cuda:0")
|
| 357 |
self.BLIPVQA = BLIPVQA(device="cuda:0")
|
| 358 |
+
self.pix2pix = Pix2Pix(device="cuda:0")
|
| 359 |
self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
|
| 360 |
self.tools = [
|
| 361 |
Tool(name="Get Photo Description", func=self.i2t.inference,
|
|
|
|
| 364 |
Tool(name="Generate Image From User Input Text", func=self.t2i.inference,
|
| 365 |
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. "
|
| 366 |
"The input to this tool should be a string, representing the text used to generate image. "),
|
| 367 |
+
Tool(name="Remove Something From The Photo", func=self.edit.remove_part_of_image,
|
| 368 |
+
description="useful when you want to remove and object or something from the photo from its description or location. "
|
| 369 |
+
"The input to this tool should be a comma seperated string of two, representing the image_path and the object need to be removed. "),
|
| 370 |
+
Tool(name="Replace Something From The Photo", func=self.edit.replace_part_of_image,
|
| 371 |
+
description="useful when you want to replace an object from the object description or location with another object from its description. "
|
| 372 |
+
"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 "),
|
| 373 |
+
|
| 374 |
+
Tool(name="Instruct Image Using Text", func=self.pix2pix.inference,
|
| 375 |
+
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. "
|
| 376 |
+
"The input to this tool should be a comma seperated string of two, representing the image_path and the text. "),
|
| 377 |
Tool(name="Answer Question About The Image", func=self.BLIPVQA.get_answer_from_question_and_image,
|
| 378 |
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. "
|
| 379 |
"The input to this tool should be a comma seperated string of two, representing the image_path and the question"),
|