import gradio as gr from huggingface_hub import hf_hub_download from comfypulid import generate_image if __name__ == "__main__": # Comment out the main() call in the exported Python code # Start your Gradio app with gr.Blocks(theme=gr.themes.Ocean(primary_hue="indigo", neutral_hue="gray", font=[gr.themes.GoogleFont("Montserrat"), "Playwrite England SemiJoine", "Quicksand"])) as app: # Add a title gr.Markdown("# FLUX Style Shaping") with gr.Row(): with gr.Column(): # Add an input prompt_input = gr.Textbox(label="Prompt", placeholder="Enter your prompt here...") # Add a `Row` to include the groups side by side with gr.Row(): # First group includes structure image and depth strength with gr.Group(): structure_image = gr.Image(label="Structure Image", type="filepath") depth_strength = gr.Slider(minimum=0, maximum=50, value=15, label="Depth Strength") # Second group includes style image and style strength with gr.Group(): style_image = gr.Image(label="Style Image", type="filepath") style_strength = gr.Slider(minimum=0, maximum=1, value=0.5, label="Style Strength") # The generate button generate_btn = gr.Button("Generate") with gr.Column(): # The output image output_image = gr.Image(label="Generated Image") # When clicking the button, it will trigger the `generate_image` function, with the respective inputs # and the output an image generate_btn.click( fn=generate_image, inputs=[prompt_input, structure_image, style_image, depth_strength, style_strength], outputs=[output_image] ) app.launch()