MCPcopy Index your code
hub / github.com/chenfei-wu/TaskMatrix / inference

Method inference

visual_chatgpt.py:262–272  ·  view source on GitHub ↗

Change style of image.

(self, inputs)

Source from the content-addressed store, hash-verified

260 "The input to this tool should be a comma separated string of two, "
261 "representing the image_path and the text. ")
262 def inference(self, inputs):
263 """Change style of image."""
264 print("===>Starting InstructPix2Pix Inference")
265 image_path, text = inputs.split(",")[0], ','.join(inputs.split(',')[1:])
266 original_image = Image.open(image_path)
267 image = self.pipe(text, image=original_image, num_inference_steps=40, image_guidance_scale=1.2).images[0]
268 updated_image_path = get_new_image_name(image_path, func_name="pix2pix")
269 image.save(updated_image_path)
270 print(f"\nProcessed InstructPix2Pix, Input Image: {image_path}, Instruct Text: {text}, "
271 f"Output Image: {updated_image_path}")
272 return updated_image_path
273
274
275class Text2Image:

Callers

nothing calls this directly

Calls 1

get_new_image_nameFunction · 0.85

Tested by

no test coverage detected