(self, inputs)
| 761 | "The input to this tool should be a comma separated string of two, " |
| 762 | "representing the image_path and the user description") |
| 763 | def inference(self, inputs): |
| 764 | image_path, instruct_text = inputs.split(",")[0], ','.join(inputs.split(',')[1:]) |
| 765 | image = Image.open(image_path) |
| 766 | self.seed = random.randint(0, 65535) |
| 767 | seed_everything(self.seed) |
| 768 | prompt = f'{instruct_text}, {self.a_prompt}' |
| 769 | image = self.pipe(prompt, image, num_inference_steps=20, eta=0.0, negative_prompt=self.n_prompt, |
| 770 | guidance_scale=9.0).images[0] |
| 771 | updated_image_path = get_new_image_name(image_path, func_name="normal2image") |
| 772 | image.save(updated_image_path) |
| 773 | print(f"\nProcessed NormalText2Image, Input Normal: {image_path}, Input Text: {instruct_text}, " |
| 774 | f"Output Image: {updated_image_path}") |
| 775 | return updated_image_path |
| 776 | |
| 777 | |
| 778 | class VisualQuestionAnswering: |
nothing calls this directly
no test coverage detected