"""Image generator tab for SDXL Model Merger.""" import gradio as gr from ..config import DEFAULT_PROMPT, DEFAULT_NEGATIVE_PROMPT from ..generator import generate_image def create_generator_tab(): """Create the image generation tab with all input controls.""" with gr.Accordion("🎨 2. Generate Image", open=True, elem_classes=["feature-card"]): # Prompts section with gr.Row(): with gr.Column(scale=1): prompt = gr.Textbox( label="Positive Prompt", value=DEFAULT_PROMPT, lines=3, placeholder="Describe the image you want to generate..." ) cfg = gr.Slider( minimum=1.0, maximum=20.0, value=7.5, step=0.5, label="CFG Scale", info="Higher values make outputs match prompt more strictly" ) height = gr.Number( value=1024, precision=0, label="Height (pixels)", info="Output image height" ) with gr.Column(scale=1): negative_prompt = gr.Textbox( label="Negative Prompt", value=DEFAULT_NEGATIVE_PROMPT, lines=3, placeholder="Elements to avoid in generation..." ) steps = gr.Slider( minimum=1, maximum=100, value=25, step=1, label="Inference Steps", info="More steps = better quality but slower" ) width = gr.Number( value=2048, precision=0, label="Width (pixels)", info="Output image width" ) # Tiling options with gr.Row(): tile_x = gr.Checkbox(True, label="X-axis Seamless Tiling") tile_y = gr.Checkbox(False, label="Y-axis Seamless Tiling") # Generate button and outputs with gr.Row(): gen_btn = gr.Button("✨ Generate Image", variant="secondary", size="lg") with gr.Row(): image_output = gr.Image( label="Result", height=400, show_label=True ) with gr.Column(): gen_status = gr.HTML( label="Generation Status", value='