import gradio as gr from diffusers import StableDiffusionPipeline import torch def dummy(images, **kwargs): return images, False def generate_image(prompt): model_id = "prompthero/openjourney-v4" pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) pipe.safety_checker = dummy pipe = pipe.to("cuda") image = pipe(prompt).images[0] return image iface = gr.Interface( generate_image, "textbox", "image", title="Image Generator", description="Generate a realistic photo using prompts.", examples=[["realistic! photoshoot for a new balenciaga lookbook, color film photography, portrait of a beautiful woman wearing a balaclava mask, photo in style of tyler mitchell, 35mm lens"]], ) iface.launch()