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

Method inference

visual_chatgpt.py:425–437  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

423 "The input to this tool should be a comma separated string of two, "
424 "representing the image_path and the user description. ")
425 def inference(self, inputs):
426 image_path, instruct_text = inputs.split(",")[0], ','.join(inputs.split(',')[1:])
427 image = Image.open(image_path)
428 self.seed = random.randint(0, 65535)
429 seed_everything(self.seed)
430 prompt = f'{instruct_text}, {self.a_prompt}'
431 image = self.pipe(prompt, image, num_inference_steps=20, eta=0.0, negative_prompt=self.n_prompt,
432 guidance_scale=9.0).images[0]
433 updated_image_path = get_new_image_name(image_path, func_name="line2image")
434 image.save(updated_image_path)
435 print(f"\nProcessed LineText2Image, Input Line: {image_path}, Input Text: {instruct_text}, "
436 f"Output Text: {updated_image_path}")
437 return updated_image_path
438
439
440class Image2Hed:

Callers

nothing calls this directly

Calls 2

seed_everythingFunction · 0.85
get_new_image_nameFunction · 0.85

Tested by

no test coverage detected