Skip to content

I want to figure out the part of code that ingests prompts sent to /sdapi/v1/txt2img #16217

Discussion options

You must be logged in to vote

In modules/api/api.py I made the following changes:

    def text2imgapi(self, txt2imgreq: models.StableDiffusionTxt2ImgProcessingAPI):
        task_id = txt2imgreq.force_task_id or create_task_id("txt2img")

        script_runner = scripts.scripts_txt2img

        infotext_script_args = {}
        self.apply_infotext(txt2imgreq, "txt2img", script_runner=script_runner, mentioned_script_args=infotext_script_args)

        selectable_scripts, selectable_script_idx = self.get_selectable_script(txt2imgreq.script_name, script_runner)

        # Modify the prompt here
        if hasattr(txt2imgreq, 'prompt'):
            original_prompt = txt2imgreq.prompt
            modified_prompt = self.modi…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by coffeegrind123
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants