The process function is the core logic for the generation service. It handles model loading (Base SD model + ConsistentID checkpoint), prompt augmentation, and inference.
Function Signature:
process(inputImage, prompt, negative_prompt)
inputImage: The reference image (as a numpy array from Gradio).prompt: The user-provided text prompt.negative_prompt: The user-provided negative prompt.
Internal Logic & Hyper-parameters:
- Prompt Augmentation: The function automatically appends cinematic descriptors (e.g.,
cinematic photo,, 50mm photograph, bokeh) to the user's prompt and appends a large group of quality-related negative prompts. - Inference Settings:
num_steps: 50merge_steps: 30width/height: 512x512
- Model Loading: Uses
ConsistentIDStableDiffusionPipeline with EulerDiscreteScheduler.
# Example conceptual usage of the process function
# input_image is a numpy array from an image source
output_path = process(input_image, "A man in a suit", "blurry, low quality")
print(f"Generated image saved at: {output_path}")