Spaces:
Runtime error
Runtime error
| import torch | |
| from diffusers import FluxPipeline | |
| import gradio as gr | |
| # Load the FLUX pipeline | |
| pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16) | |
| pipe.enable_model_cpu_offload() # For memory efficiency | |
| def generate_image(prompt): | |
| # Generate the image based on user prompt | |
| image = pipe(prompt, height=512, width=512, guidance_scale=3.5, num_inference_steps=50).images[0] | |
| return image | |
| # Create a Gradio interface | |
| interface = gr.Interface( | |
| fn=generate_image, | |
| inputs="text", | |
| outputs="image", | |
| title="FLUX Image Generator", | |
| description="Enter a text prompt to generate a futuristic 3D-style image using the FLUX model." | |
| ) | |
| if __name__ == "__main__": | |
| interface.launch() |