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

Method inference

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

Source from the content-addressed store, hash-verified

365 "The input to this tool should be a comma separated string of two, "
366 "representing the image_path and the user description. ")
367 def inference(self, inputs):
368 image_path, instruct_text = inputs.split(",")[0], ','.join(inputs.split(',')[1:])
369 image = Image.open(image_path)
370 self.seed = random.randint(0, 65535)
371 seed_everything(self.seed)
372 prompt = f'{instruct_text}, {self.a_prompt}'
373 image = self.pipe(prompt, image, num_inference_steps=20, eta=0.0, negative_prompt=self.n_prompt,
374 guidance_scale=9.0).images[0]
375 updated_image_path = get_new_image_name(image_path, func_name="canny2image")
376 image.save(updated_image_path)
377 print(f"\nProcessed CannyText2Image, Input Canny: {image_path}, Input Text: {instruct_text}, "
378 f"Output Text: {updated_image_path}")
379 return updated_image_path
380
381
382class Image2Line:

Callers

nothing calls this directly

Calls 2

seed_everythingFunction · 0.85
get_new_image_nameFunction · 0.85

Tested by

no test coverage detected