import gradio as gr def generate_image(prompt): model = gr.load("models/black-forest-labs/FLUX.1-schnell") return model(prompt) with gr.Blocks() as demo: gr.Markdown("# Text to Image Generator") gr.Markdown("Enter a text prompt to generate an image using the FLUX.1-dev model.") with gr.Row(): with gr.Column(scale=4): text_input = gr.Textbox(label="Text Prompt", placeholder="Enter your prompt here...") with gr.Column(scale=1): submit_button = gr.Button("Generate Image") image_output = gr.Image(label="Generated Image") submit_button.click(fn=generate_image, inputs=text_input, outputs=image_output) if __name__ == "__main__": .launch()